IE中的prettyPhoto无法正常工作

时间:2011-07-01 15:12:26

标签: jquery html css

prettyPhoto在IE7上无法正常显示。我在画廊中有3张图片,当我点击第三张图片时,图片叠加层才出现,其他图片就像普通图片一样(它只是到图片位置)。

这是我的代码:

<ul class="gallery clearfix">
            <li><a href="images/j/DSCN0868.jpg" rel="prettyPhoto[gallery1]" title="Hermoso "><img src="images/j/DSCN0868.jpg" width="250" height="180" alt="" /></a></li>
            <li><a href="images/j/DSCN0863.jpg" rel="prettyPhoto[gallery1]"><img src="images/j/DSCN0863.jpg" width="250" height="180" alt="" /></a></li>
            <li><a href="images/j/DSCN0855.jpg" rel="prettyPhoto[gallery1]"><img src="images/j/DSCN0855.jpg" width="250" height="180" alt="" /></a></li>
                        </ul>

Javascript:

<link rel="stylesheet" href="prettyPhoto/css/prettyPhoto.css" type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="prettyPhoto/js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
    $(document).ready(function(){
            $("area[rel^='prettyPhoto']").prettyPhoto();

            $(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'normal',theme:'light_rounded',slideshow:3000, autoplay_slideshow: false});
            $(".gallery:gt(0) a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'fast',slideshow:10000, hideflash: true});

            $("#custom_content a[rel^='prettyPhoto']:first").prettyPhoto({
                    custom_markup: '<div id="map_canvas" style="width:260px; height:265px"></div>',
                    changepicturecallback: function(){ initialize(); }
            });

            $("#custom_content a[rel^='prettyPhoto']:last").prettyPhoto({
                    custom_markup: '<div id="bsap_1259344" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div><div id="bsap_1237859" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6" style="height:260px"></div><div id="bsap_1251710" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div>',
                    changepicturecallback: function(){ _bsap.exec(); }
            });
    });
</script>

谢谢!

2 个答案:

答案 0 :(得分:0)

尝试将与此图库相关的js代码更改为:

        $(".gallery li:first a").prettyPhoto({animation_speed:'normal',theme:'light_rounded',slideshow:3000, autoplay_slideshow: false});
        $(".gallery li").slice(1).children('a').prettyPhoto({animation_speed:'fast',slideshow:10000, hideflash: true});

应该工作:D

顺便说一句。当提出这样的问题包括一个例子的链接,或者最好是一个jsfiddle演示。

答案 1 :(得分:0)

我看到你在3-4个不同的选择器上调用prettyPhoto(),你确定这些选择器不会多次包含一个元素吗?这个原因是原因的来源。

尝试总结每个选择器中匹配元素的长度来测试它。