查看標題。它似乎加載得很好,並很好地轉換成一張圖片,但之後拒絕工作。jQuery幻燈片在自定義WordPress模板中的一張圖片後停止
當我使用Chrome瀏覽器檢查並查看出了什麼問題時,它告訴我它無法識別slideSwitch功能,即使我在本地測試它時工作正常。
無論如何,我希望這裏的主人在stackoverflow將能夠幫助我的無力的頭腦自我。
在此先感謝。
jQuery代碼:
$(function slideSwitch() {
var $active = $('#slideshow img.active');
if ($active.length == 0) $active = $('#slideshow img:last');
var $next = $active.next().length ? $active.next() : $('#slideshow img:first');
$active.addClass('last-active');
$next.css({
opacity: 0.0
}).addClass('active').animate({
opacity: 1.0
}, 2000, function() {
$active.removeClass('active last-active');
});
});
$(function() {
setInterval("slideSwitch()", 5000);
});
下面是它附帶的CSS:
#slideshow {
height:327px;
border:thick #000;
list-style:none;
margin:0px auto;
width:600px;
overflow: hidden;
position:relative;
}
#slideshow img {
border: solid #000000 10px;
display:block;
position:absolute;
z-index: 8;
}
#slideshow img.active {
z-index:10;
}
#slideshow img.last-active {
z-index:9;
}
哎你能彈出在一些HTML中,也許能夠幫助你,歡呼!如果你不能給HTML看這裏的例子 - **工作** http://jsfiddle.net/skelly/D6BGj/(和振作起來,兄弟,大家都很好,包括你,所以沒有人是軟弱的頭腦:) – 2012-03-30 07:18:52