0

当我在谷歌上搜索这个时,我得到了很多 wordpress 插件响应,所以我在这里问。

我有一个 wordpress.org 博客。有一个链接,点击后,我想打开一个带有一些内容的花式框,实际上是一个带有标题的 spotify 嵌入播放列表。

我已经包含了所有的 fancybox 文件并进行了初始化,但没有运气。这是我的代码:

初始化:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo get_template_directory_uri();?>/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri();?>/fancybox/jquery.fancybox-1.3.4.css" media="screen" /> 
  <script type="text/javascript">
                    $(document).ready(function() {
                        $("a#playlist_pop").fancybox({
                                'overlayShow'   : false,
                                'transitionIn'  : 'elastic',
                                'transitionOut' : 'elastic'
                        });
                    });
                  </script> 

这是我的html:

<div class="spotify_header" style="padding-bottom: 10px;padding-top: 10PX;text-align: center">CHECK US OUT ON <a id="playlist_pop" href="#playlist_data"><span>SPOTIFY</span></a>
                        <div style="display:none">
                            <div id="playlist_data">
                                <div id="Spotiplay">
                                    <h3>Artists We Love</h3><br/>
                                    <div id="playlist_pop_con"><iframe src="https://embed.spotify.com/?uri=spotify:user:yalefox:playlist:3NCBHSkbl0jLZtUnNWkdPh" width="312" height="392" frameborder="0" allowtransparency="true"></iframe></div>
                                </div>
                            </div>
            </div></div>

谁能帮我这个?令人难以置信的是,如此简单的事情如何在 wordpress 中变得如此痛苦。

我在控制台中收到此错误消息: Uncaught TypeError: Object [object Object] has no method 'fancybox'

这是否意味着它没有读取 fancybox js 文件?

4

1 回答 1

0

非常感谢帮忙。不确定它是否与我客户的博客配置有关,或者只是缺乏对常规 Fancybox 1.3.2 和 wordpress.org 的支持,但我不得不求助于 Lytebox wordpress 插件 - http://wordpress.org/extend /plugins/lytebox/ - 你只需在 a 标签中包含一个 rel="lyteframe" ..我将它重新设计为看起来就像一个 fancybox,所以虽然不是最佳的或像 fancybox 一样健壮,但它不是一个糟糕的选择

于 2012-08-11T00:42:18.320 回答