我创建了自己的WP主题。我添加了一个JS Carousel。在旋转木马的每个部分,我都有一个描述和视频。您可以在www.tvstartup.com上看到它。问题是它想要弹出播放的视频并不总是有效。在某些情况下,它确实存在,而在其他情况下却没有。 这是代码示例:
<div class="carousel_item">
<div class="image">
<img src="<?php echo get_template_directory_uri(); ?>/images/final/internet-tv.png" alt="Internet TV" />
</div>
<div class="caption">
<h2>Internet TV</h2>
<p>Ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehender.</p>
<div class="btn-wrap">
<div class="button">
PRICING
</div>
<div class="button" id="contact">
CONTACT US
</div>
</div>
<div id="internetvideocontainer" style="display:none;">
<a href="#" onclick="popup('internetvideocontainer'); stopinternetvideo();" style="cursor: pointer; font-size: 30px; color: red;">Click to Close</a>
<video width="700" height="400" id="internetvideoplayer" controls>
<source src="<?php echo get_template_directory_uri(); ? >/images/videos/WelcometoTvStartUp.mp4" type="video/mp4">
</video>
<a href="#" onclick="popup('internetvideocontainer'); stopinternetvideo();" style="cursor: pointer; font-size: 30px; color: red;">Click to Close</a>
</div>
<a href="#" style="cursor: pointer" onclick="popup('internetvideocontainer'); playinternetvideo();">
<img src="<?php echo get_template_directory_uri(); ?>/images/watchImg.png" alt="click to see video" class="internettvtumbnail" style="padding-top:45px; width:250; height:150px;">
</a>
</div>
</div>
任何帮助,
谢谢
答案 0 :(得分:0)
转换所有jquery语句
$(.....
到
jQuery(....
答案 1 :(得分:0)
The right way
function load_my_script() {
wp_enqueue_script( 'jquery' );
}
add_action( 'wp_enqueue_scripts', 'load_my_script' );
and change all '$(' to 'jQuery('
The Not So right Way
Add the following code in the header.php
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
The latter will work for you but I would suggest you change your code to avoid further issues.