gpt4 book ai didi

javascript - 如何使用 Thickbox 显示视频?

转载 作者:行者123 更新时间:2023-11-28 13:05:59 25 4
gpt4 key购买 nike

我正在尝试使用 thickbox 在页面上显示视频。按照网站上的说明进行操作,但当我点击链接时,它只会将我带到 youtube 页面,这不是我想要的。

我在标题中调用了 jquery 和 thickbox,还有 thick box 的 css:

<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">

下面是正文中的代码:

<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>

为了保护隐私,我对上面代码中的一些信息进行了哈希处理。关于可能出错的任何建议?

编辑:可能应该提到我在 word press 中使用它

最佳答案

您需要加载 ThickBox <script /> AFTER jQuery 文件...如下面的代码。

编辑:另外,将您拥有的 jQuery 脚本替换为我在示例中使用的 CDN jQuery 版本。然后清空浏览器cache (在使用 WP 时很重要)。

<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">

根据经验,您的 jQuery <script />应该始终是列出的第一个 js 文件。它需要在您的其他 js 脚本之前首先加载(假设您的其余脚本需要 jQuery)。否则它们不会被启动。

关于javascript - 如何使用 Thickbox 显示视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20201876/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com