我有一段代碼在這裏,它的工作原理,但不知道爲什麼我的fadein和fadeout不適用於身體, 如果你認爲我的問題,請讓我知道謝謝問題與jquery fadein
<script type="text/javascript">
$(window).load(function() {
var lastSlide = "";
$('#slider').nivoSlider({
effect: 'random',
directionNavHide : true,
slices : 15,
animSpeed : 500,
pauseTime : 6000,
controlNav : false,
pauseOnHover : true,
directionNav:true, //Next & Prev
directionNavHide:true, //Only show on hover
beforeChange: function(){
if(lastSlide == "images/header_used.jpg") { //use the bg image of the slide that comes before the newslide
$("body").attr("style","background: #000 url(images/bg.jpg) top center no-repeat;").fadeIn("slow");
} else {
$("body").attr("style","background: #ADADAD url(images/bgnd_grad.jpg) repeat-x;").fadeOut("slow");
}
},
afterChange: function() {
t = $(this).children("a:visible");
lastSlide = $("img", t).attr("src");
}
});
});
</script>
'$(「身體」)ATTR(「風格」,「背景:#000網址( (「images/bg.jpg)top center no-repeat;」)。fadeIn(「slow」);' - should be - '$(「body」)。css(「background」,「url(images/bg.jpg) no-repeat center top#000「)。fadeIn(」slow「);' – Reflective
嘿,感謝您的回覆仍然無法正常工作。 – mmz