Nivo 滑块不适用于 IE7

发布于 2024-10-30 18:28:19 字数 5028 浏览 0 评论 0原文

我已经在这个网站上查看了很多关于 Nivo Slider 问题的帖子。我检查了 javascript 中的逗号,它看起来对我来说是正确的:

<script type="text/javascript">
$(window).load(function() {
    $('#slider').nivoSlider({
        effect:'fade', 
        slices:15,
        animSpeed:500, 
        pauseTime:4000,
        startSlide:0,
        directionNav:false, 
        directionNavHide:false, 
        controlNav:true,
        controlNavThumbs:false, 
        controlNavThumbsFromRel:false, 
        controlNavThumbsSearch: '.jpg', 
        controlNavThumbsReplace: '_thumb.jpg', 
        keyboardNav:true,
        pauseOnHover:true, 
        manualAdvance:false, 
        captionOpacity:0.9, 
        beforeChange: function(){},
        afterChange: function(){},
        slideshowEnd: function(){}, 
        lastSlide: function(){}, 
        afterLoad: function(){} 
    });
});
</script>

这是它引用的 html。文件夹路径似乎是正确的(毕竟,它可以在其他浏览器中工作!):

<div id="slider_wrapper">
        <div id="slider">
            <img src="/CoVPrototype/images/nivoslider/_img1.jpg" alt="" title="Discover City Parks" />
            <img src="/CoVPrototype/images/nivoslider/_img2.jpg" alt="" title="Enjoy Our Beautiful City" />
            <img src="/CoVPrototype/images/nivoslider/_img3.jpg" alt="" title="This is an example of a caption" />
            <img src="/CoVPrototype/images/nivoslider/_img4.jpg" alt="" title="This is Our Home" />
            <img src="/CoVPrototype/images/nivoslider/_img5.jpg" alt="" title="Mild Tempuratures and Natural Beauty" />
        </div>
    </div>

最后,这里是 javascript 的链接:

<script src="/CoVPrototype/js/jquery.nivo.slider.pack.js" type="text/javascript"></script>

我已经浪费了半天时间试图解决这个问题!希望这个强大的列表可以发现问题!

我想我也会添加CSS,以防万一这可能是罪魁祸首:

#slider_wrapper {
    margin:0 auto;
    width:740px;
    height:360px;
}
#slider {
    width:738px; /* Change this to your images width */
    height:360px; /* Change this to your images height */
    background:url(/CoVPrototype/images/nivoslider/loading.gif) no-repeat 50% 50%;
    overflow:hidden;
    margin-top:25px;
    left:-96px;
    /*--Top right rounded corner--*/
    -moz-border-radius-topright: 5px;
    -khtml-border-radius-topright: 5px;
    -webkit-border-top-right-radius: 5px;
    /*--Top left rounded corner--*/
    -moz-border-radius-topleft: 5px;
    -khtml-border-radius-topleft: 5px;
    -webkit-border-top-left-radius: 5px;
    /*--Bottom right rounded corner--*/
    -moz-border-radius-bottomright: 5px;
    -khtml-border-radius-bottomright: 5px;
    -webkit-border-bottom-right-radius: 5px;
    /*--Bottom left rounded corner--*/
    -moz-border-radius-bottomleft: 5px;
    -khtml-border-radius-bottomleft: 5px;
    -webkit-border-bottom-left-radius: 5px;
}
#slider img {
    position:absolute;
    top:0px;
    left:0px;
    display:none;
}
#slider a {
    border:0;
    display:block;
}

.nivoSlider {
    position:relative;
}
.nivoSlider img {
    position:absolute;
    top:0px;
    left:0px;
}
/* If an image is wrapped in a link */
.nivoSlider a.nivo-imageLink {
    position:absolute;
    top:0px;
    left:0px;
    width:100%;
    height:100%;
    border:0;
    padding:0;
    margin:0;
    z-index:60;
    display:block;
}
/* The slices in the Slider */
.nivo-slice {
    display:block;
    position:absolute;
    z-index:50;
    height:100%;
    /*--Top right rounded corner--*/
    -moz-border-radius-topright: 5px;
    -khtml-border-radius-topright: 5px;
    -webkit-border-top-right-radius: 5px;
    /*--Top left rounded corner--*/
    -moz-border-radius-topleft: 5px;
    -khtml-border-radius-topleft: 5px;
    -webkit-border-top-left-radius: 5px;
    /*--Bottom right rounded corner--*/
    -moz-border-radius-bottomright: 5px;
    -khtml-border-radius-bottomright: 5px;
    -webkit-border-bottom-right-radius: 5px;
    /*--Bottom left rounded corner--*/
    -moz-border-radius-bottomleft: 5px;
    -khtml-border-radius-bottomleft: 5px;
    -webkit-border-bottom-left-radius: 5px;
}
/* Caption styles */
.nivo-caption {
    position:absolute;
    left:0px;
    bottom:0px;
    background:#F1F0EB;
    color:#5D79A1;
    filter: alpha(opacity=90);
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
 /* Overridden by captionOpacity setting */
    width:100%;
    z-index:89;
    height:32px;
    /*--Bottom right rounded corner--*/
    -moz-border-radius-bottomright: 5px;
    -khtml-border-radius-bottomright: 5px;
    -webkit-border-bottom-right-radius: 5px;
    /*--Bottom left rounded corner--*/
    -moz-border-radius-bottomleft: 5px;
    -khtml-border-radius-bottomleft: 5px;
    -webkit-border-bottom-left-radius: 5px;
}
.nivo-caption p {
    padding:8px 5px 5px 11px;
    margin:0;
    font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
    font-size:1.1em;
}
.nivo-caption a {
    display:inline !important;
}
.nivo-html-caption {
    display:none;
}

I have reviewed quite a few posts on this site concerning this issue with Nivo Slider. I have checked my commas in the the javascript and it looks right to me:

<script type="text/javascript">
$(window).load(function() {
    $('#slider').nivoSlider({
        effect:'fade', 
        slices:15,
        animSpeed:500, 
        pauseTime:4000,
        startSlide:0,
        directionNav:false, 
        directionNavHide:false, 
        controlNav:true,
        controlNavThumbs:false, 
        controlNavThumbsFromRel:false, 
        controlNavThumbsSearch: '.jpg', 
        controlNavThumbsReplace: '_thumb.jpg', 
        keyboardNav:true,
        pauseOnHover:true, 
        manualAdvance:false, 
        captionOpacity:0.9, 
        beforeChange: function(){},
        afterChange: function(){},
        slideshowEnd: function(){}, 
        lastSlide: function(){}, 
        afterLoad: function(){} 
    });
});
</script>

Here is the html it is referencing. The folder path seems to be correct (afterall, it's working in other browsers!):

<div id="slider_wrapper">
        <div id="slider">
            <img src="/CoVPrototype/images/nivoslider/_img1.jpg" alt="" title="Discover City Parks" />
            <img src="/CoVPrototype/images/nivoslider/_img2.jpg" alt="" title="Enjoy Our Beautiful City" />
            <img src="/CoVPrototype/images/nivoslider/_img3.jpg" alt="" title="This is an example of a caption" />
            <img src="/CoVPrototype/images/nivoslider/_img4.jpg" alt="" title="This is Our Home" />
            <img src="/CoVPrototype/images/nivoslider/_img5.jpg" alt="" title="Mild Tempuratures and Natural Beauty" />
        </div>
    </div>

and finally, here is the link to the javascript:

<script src="/CoVPrototype/js/jquery.nivo.slider.pack.js" type="text/javascript"></script>

I have wasted half a day trying to get this issue resolved! Hopefully this mighty list can spot the problem!!

Thought I would add the css too in case this could be the culprit somehow:

#slider_wrapper {
    margin:0 auto;
    width:740px;
    height:360px;
}
#slider {
    width:738px; /* Change this to your images width */
    height:360px; /* Change this to your images height */
    background:url(/CoVPrototype/images/nivoslider/loading.gif) no-repeat 50% 50%;
    overflow:hidden;
    margin-top:25px;
    left:-96px;
    /*--Top right rounded corner--*/
    -moz-border-radius-topright: 5px;
    -khtml-border-radius-topright: 5px;
    -webkit-border-top-right-radius: 5px;
    /*--Top left rounded corner--*/
    -moz-border-radius-topleft: 5px;
    -khtml-border-radius-topleft: 5px;
    -webkit-border-top-left-radius: 5px;
    /*--Bottom right rounded corner--*/
    -moz-border-radius-bottomright: 5px;
    -khtml-border-radius-bottomright: 5px;
    -webkit-border-bottom-right-radius: 5px;
    /*--Bottom left rounded corner--*/
    -moz-border-radius-bottomleft: 5px;
    -khtml-border-radius-bottomleft: 5px;
    -webkit-border-bottom-left-radius: 5px;
}
#slider img {
    position:absolute;
    top:0px;
    left:0px;
    display:none;
}
#slider a {
    border:0;
    display:block;
}

.nivoSlider {
    position:relative;
}
.nivoSlider img {
    position:absolute;
    top:0px;
    left:0px;
}
/* If an image is wrapped in a link */
.nivoSlider a.nivo-imageLink {
    position:absolute;
    top:0px;
    left:0px;
    width:100%;
    height:100%;
    border:0;
    padding:0;
    margin:0;
    z-index:60;
    display:block;
}
/* The slices in the Slider */
.nivo-slice {
    display:block;
    position:absolute;
    z-index:50;
    height:100%;
    /*--Top right rounded corner--*/
    -moz-border-radius-topright: 5px;
    -khtml-border-radius-topright: 5px;
    -webkit-border-top-right-radius: 5px;
    /*--Top left rounded corner--*/
    -moz-border-radius-topleft: 5px;
    -khtml-border-radius-topleft: 5px;
    -webkit-border-top-left-radius: 5px;
    /*--Bottom right rounded corner--*/
    -moz-border-radius-bottomright: 5px;
    -khtml-border-radius-bottomright: 5px;
    -webkit-border-bottom-right-radius: 5px;
    /*--Bottom left rounded corner--*/
    -moz-border-radius-bottomleft: 5px;
    -khtml-border-radius-bottomleft: 5px;
    -webkit-border-bottom-left-radius: 5px;
}
/* Caption styles */
.nivo-caption {
    position:absolute;
    left:0px;
    bottom:0px;
    background:#F1F0EB;
    color:#5D79A1;
    filter: alpha(opacity=90);
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
 /* Overridden by captionOpacity setting */
    width:100%;
    z-index:89;
    height:32px;
    /*--Bottom right rounded corner--*/
    -moz-border-radius-bottomright: 5px;
    -khtml-border-radius-bottomright: 5px;
    -webkit-border-bottom-right-radius: 5px;
    /*--Bottom left rounded corner--*/
    -moz-border-radius-bottomleft: 5px;
    -khtml-border-radius-bottomleft: 5px;
    -webkit-border-bottom-left-radius: 5px;
}
.nivo-caption p {
    padding:8px 5px 5px 11px;
    margin:0;
    font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
    font-size:1.1em;
}
.nivo-caption a {
    display:inline !important;
}
.nivo-html-caption {
    display:none;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

呢古 2024-11-06 18:28:19

我在 NivoSlider 和 IE7 上遇到了同样的问题,结果发现这是“pauseTime”属性的问题。

将其移至 jQuery 函数的末尾并删除逗号。完成此操作后,滑块在 IE7 中工作正常。

原文:

pauseTime: 4500, // How long each slide will show
pauseOnHover: true, // Stop animation while hovering

编辑

pauseOnHover: true, // Stop animation while hovering
pauseTime: 4500 // How long each slide will show

请参阅 Dev7Studios 支持论坛以了解更多信息。

I had the same issue with NivoSlider and IE7, turns out it was an issue with the "pauseTime" attribute.

Move it to the end of your jQuery function and remove the comma. After doing this the slider worked fine in IE7.

Original:

pauseTime: 4500, // How long each slide will show
pauseOnHover: true, // Stop animation while hovering

Edited

pauseOnHover: true, // Stop animation while hovering
pauseTime: 4500 // How long each slide will show

See the support forums for Dev7Studios to read more.

紅太極 2024-11-06 18:28:19

我基本上找到了 Tyce Clee 发现的内容 - 只要确保最后一个参数末尾没有逗号即可。我只是觉得有必要发帖,因为这适用于任何参数,而不仅仅是暂停时间。

I have found basically what Tyce Clee found - just make sure there is no comma at the end of the last parameter. I just felt the need to post because that applies to any parameter, not just pause time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文