我有一个非常愚蠢的功能,可以在div中滑出图像。
唯一的问题是淡入/淡出而不是滑动。
var w = $win.width();
var x = $(this).hasClass("stac-icon-scrollarrow-right") ? -w : w;
var x2 = $(this).hasClass("stac-icon-scrollarrow-right") ? w : -w;
var s;
currentIndex = 0;
function slide() {
if ( currentIndex >= $('.slide img').length )
currentIndex = 0
if ( currentIndex < 0 )
currentIndex = $('.slide img').length - 1
$('.slide').fadeOut(500, function () {
$el = $('.slides img:eq('+currentIndex+')');
$('.slide').attr('src', $el.attr('src'));
$('.slide').fadeIn(500);
});
}
currentIndex++;
slide();