我正在尝试将幻灯片添加到我的某个网站.整个页面都放在一个HTML表格中(我讨厌它并且没有选择).我想将幻灯片放在那个特殊的列中.这是我的CSS看起来像:
#slideshow {
position:relative;
}
#slideshow IMG {
position:absolute;
z-index:8;
opacity:0.0;
}
#slideshow IMG.active {
z-index:10;
opacity:1.0;
}
#slideshow IMG.last-active {
z-index:9;
}
Run Code Online (Sandbox Code Playgroud)
这是我的JQuery函数来更改图像:
function slideSwitch() {
var $active = $('#slideshow IMG.active');
if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
// use this to pull the images in the order they appear in the markup
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}, 1000, function() {
$active.removeClass('active last-active');
});
}
$(function() …Run Code Online (Sandbox Code Playgroud)