我将以下脚本用于动画背景,现在图片淡入淡出,但我希望它们水平向左滑动。
我的问题是,这是一个标准的 jquery“函数”吗,因为我很难找到执行此操作的正确方法。
有没有人能帮我修改我的代码,让它做我想做的事?
提前致谢。
我正在使用的代码:
$(function(){
$('#background img:gt(0)').hide();
setInterval(function(){
$('#background :first-child').fadeOut()
.next('img').fadeIn()
.end().appendTo('#background');},
3000);
});
最佳答案
您可以使用 JQuery .animate()
水平切换。例如:
$('#background :first-child').animate({width: 'toggle'})
.next('img').animate({width: 'toggle'})
.end().appendTo('#background');},
3000);
关于javascript - 在jquery中水平滑动淡入淡出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28412635/