Javascript 如何使用Thickbox显示视频?
我正在尝试使用thickbox在页面上显示视频。按照网站上的说明操作,但当我点击链接时,它只会将我带到youtube页面,这不是我想要的 我的标题中有对jquery和thickbox的调用,以及对厚框的css:Javascript 如何使用Thickbox显示视频?,javascript,jquery,html,css,thickbox,Javascript,Jquery,Html,Css,Thickbox,我正在尝试使用thickbox在页面上显示视频。按照网站上的说明操作,但当我点击链接时,它只会将我带到youtube页面,这不是我想要的 我的标题中有对jquery和thickbox的调用,以及对厚框的css: <script src="<?php bloginfo('template_url'); ?>/javascripts/thickbox.js"></script> <script src="<?php bloginfo('template
<script src="<?php bloginfo('template_url'); ?>/javascripts/thickbox.js"></script>
<script src="<?php bloginfo('template_url'); ?>/javascripts/jquery.js"></script>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/stylesheets/thickbox.css">
您需要在jQuery文件之后加载ThickBox,如下代码所示
编辑:另外,用我在示例中使用的CDN jQuery版本替换您的jQuery脚本。然后清除浏览器缓存(使用WP时很重要)
我切换了两个,但仍然不能正常工作。当你点击链接时…会发生什么?点击链接后,你会发现哪些控制台错误(在Chrome或Firebug中)?点击链接后,我不会在Chrome中发现任何控制台错误,它只会将我带到youtube页面。在我点击链接之前,控制台告诉我:uncaughtreferenceerror:$未定义thickbox.js:14在控制台中,键入$.fn.jquery
并告诉我结果。另外,请清除浏览器缓存,然后重试。你100%确定jQuery脚本在thichbox.js文件上方,对吗?旁注(与问题无关),你应该把
放在的周围(1960年B.S.M.E.)
而不是锚本身。)
<strong>
<a class="thickbox" href="//www.youtube.com/embed/########?rel=0?KeepThis=true&TB_iframe=true&height=400&width=600" title="##### Hanson">
<img src="http://www.#########.org/campaign/wp-content/uploads/sites/59/2013/09/#####.jpg"/>
</a> ##### Hanson*<br>(1960 B.S.M.E.)
</strong>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="<?php bloginfo('template_url'); ?>/javascripts/thickbox.js"></script>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/stylesheets/thickbox.css">