我有一个学习管理 Wordpress 主题,它会根据您所在的视频自动生成指向上一个和下一个视频的链接(视频 2 将在视频描述中包含指向视频 1 的上一个链接和指向视频 3 的下一个链接)。我想在我的自定义视频播放中添加上一个和下一个按钮,点击后会触发 WordPress 主题已经生成的上一个和下一个链接。我怎么会有一个按钮,当点击时,点击同一页面上的链接?<!DOCTYPE html><html dir="ltr"> <head> <meta charset="utf-8"> <title>HTML 5 VIDEO PLAYER</title> <script src="main.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <link href="font-awesome/css/all.css" rel="stylesheet"> <link href="style.css" rel="stylesheet"></head><body><!-- Previous & Next Video Buttons --> <div id="video-arrows"> <button type="button" id="previous-arrow"><a href="previous-video"></a><i class="fas fa-chevron-left"></i></button> <button type="button" id="next-arrow"><a href="next-video"></a><i class="fas fa-chevron-right"></i></button> </div><div class="random-text"> <h1>Video title</h1> <h4><span id="view-count"></span> views</h4> <p>Descriptions can convey valuable information that helps viewers find your videos in search results and understand what they’ll be watching. Well-written descriptions with the right keywords can boost views and watch time because they help your video show up in search results.</p> <a href="https://www.icloud.com/" target="_blank" id="previous-video">Previous</a> <a href="https://google.com" target="_blank" id="next-video">Next</a> </div></body></html>window.onload = function() {var nextArrow = document.getElementById('next-arrow')var prevArrow = document.getElementById('previous-arrow')$(document).ready(function(){ $(nextArrow).on('click', function () { $('#next-video').click(); }); $(prevArrow).on('click', function () { $('#previous-video').click(); });});}它没有给出任何错误它只是不起作用
添加回答
举报
0/150
提交
取消