Fancybox没有开火

时间:2012-02-29 09:40:35

标签: jquery fancybox

我正在创建一个简单的画廊,fancybox似乎没有被解雇,我不知道为什么,我之前在其他网站上使用过它并且工作正常:

DOCTYPE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

脚本,css调用和js - 脚本源确认

<link href="../js/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>

<script src="../js/fancybox/jquery.easing-1.3.pack.js" type="text/javascript"></script>
<script src="../js/fancybox/jquery.fancybox-1.3.4.js" type="text/javascript"></script>

<script type="text/javascript">
        $(document).ready(function() {

            $("a[rel=gallery]").fancybox({
            'autoScale' : true,
            'transitionIn' : 'fade',
            'transitionOut' : 'fade'
                }
            });

        });
</script>

和我用来生成文件夹中的拇指以及调用fancybox的href

$files = glob("../gallery/gallery/*.*"); 

for ($i=1; $i<count($files); $i++) 
{
 $num = $files[$i]; echo '<a class="fancybox" rel=gallery href="'.$num.'">
 <img src="'.$num.'" class="gallery_img" alt="random image"></a>'; 
 } 

这是实际页面中呈现的html:

<a class="fancybox" rel="gallery" href="../gallery/gallery/cat.jpg">
<img src="../gallery/gallery/cat.jpg" class="gallery_img" alt="random image">
</a>
<a class="fancybox" rel="gallery" href="../gallery/gallery/flypike.jpg">
<img src="../gallery/gallery/flypike.jpg" class="gallery_img" alt="random image">
</a>
<a class="fancybox" rel="gallery" href="../gallery/gallery/zandrb.jpg">
<img src="../gallery/gallery/zandrb.jpg" class="gallery_img" alt="random image"></a>    

2 个答案:

答案 0 :(得分:1)

}

之后删除额外的'transitionOut' : 'fade'

答案 1 :(得分:-3)

控制台找到完整的语法错误,非常感谢您的建议,之前从未使用过:

<script type="text/javascript">
    $(document).ready(function() {

        $("a[rel=gallery]").fancybox({
        'autoScale' : true,
        'transitionIn' : 'fade',
        'transitionOut' : 'fade'
            } // shouldn't be there
        });

    }); // shouldn't be there
</script>