0

我目前在我的网站上启动并运行了 Nivo-Slider。加载后效果很好 - 但在加载时,它被放置在我屏幕的左上角。加载后 - 它会转到我在 CSS 中指定的位置。我试图找出加载屏幕的 CSS 容器,但我不确定从哪里开始。

加载问题图片:http: //i46.tinypic.com/szdg7s.jpg

我希望加载功能在我的布局中看起来像什么:http: //i50.tinypic.com/uyfyb.jpg

我在索引中的 Nivo 代码:

<!--/ Run Nivo-->
<script type="text/javascript">
$(window).load(function() {
    $('#slider').nivoSlider({
        effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
        slices: 15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed: 500, // Slide transition speed
        pauseTime: 3000, // How long each slide will show
        startSlide: 0, // Set starting Slide (0 index)
        directionNav: true, // Next & Prev navigation
        directionNavHide: true, // Only show on hover
        controlNav: true, // 1,2,3... navigation
        controlNavThumbs: false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel: false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav: true, // Use left & right arrows
        pauseOnHover: true, // Stop animation while hovering
        manualAdvance: false, // Force manual transitions
        captionOpacity: 0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        randomStart: false, // Start on a random slide
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });
});
</script>


<script type="text/javascript">
$(window).load(function() {
    $('#slider').nivoSlider();
});
</script>




 <!--/ Show Nivo--> 

<div class="slider-wrapper theme-default">
    <div class="ribbon"></div>
    <div id="slider" class="nivoSlider">
    <img src="/dev/images/scs-logo.jpg" alt="" />
    <img src="/dev/images/signage.jpg" alt="" />
    <img src="/dev/images/wsop.jpg" alt="" />

</div>

加载后放置 Nivo 幻灯片的 CSS 代码:

/*Nivo-Slider Div*/

#slider {
    position: absolute;
    margin-left: auto; 
    margin-right: auto;

}
4

2 回答 2

3

确保您没有添加#slider.nivoSliderCSS 中的类。这就是我解决定位问题的方法。我在 CSS 中添加#slider.nivoSlider类,它所做的就是将我的幻灯片带到屏幕的左上角。:\

于 2012-10-12T18:03:47.447 回答
0

试试这个:

#slider { margin:0 auto; float:left; width:100%; }
于 2012-05-17T12:44:42.457 回答