放置Nivo-Slider载入画面

时间:2012-05-17 05:28:14

标签: jquery html css

我目前在我的网站上运行Nivo-Slider。它在加载后效果很好 - 但在加载时,它被放置在我的屏幕的左上方。加载后 - 它会转到我指导它进入CSS的地方。我正在试图找出加载屏幕的CSS容器,但我不知道从哪里开始。

装货问题图片: http://i46.tinypic.com/szdg7s.jpg

我想在我的布局中看起来像加载函数: http://i50.tinypic.com/uyfyb.jpg

索引中的我的新代码:

<!--/ 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;

}

2 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:0)

试试这个:

#slider { margin:0 auto; float:left; width:100%; }