0

尝试使用 jquery bgswitcher 制作背景滑块。我的代码

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">

</script>
<script src="js/jquery.bgswitcher.js"></script>

<script>
    $(".wrapper").bgswitcher({
        images: ["img/1.jpg", "img/2.png", "img/3.jpg", "img/4.png"],
        effect: "fade",
        interval: 5000,
        loop: false,
        shuffle: false,
        duration: 5000,
        easing: "swing"
    });
</script>

我不知道这段代码有什么问题,但是背景滑块不起作用!任何的想法?

4

1 回答 1

1

在 document.ready 中初始化 bgswitcher...

<script>
$(document).ready(function(){

$(".wrapper").bgswitcher({
images: ["img/1.jpg", "img/2.png", "img/3.jpg", "img/4.png"], 
effect: "fade", 
interval: 5000, 
loop: false, 
shuffle: false, 
duration: 5000, 
easing: "swing"
});

});
</script>
于 2013-08-30T05:22:02.367 回答