我正在使用以下脚本作为动画背景,现在图片淡入淡出和淡出但我希望它们水平滑动到左侧。
我的问题是,这是一个标准的jquery“函数”,因为我无法找到正确的方法来执行此操作。
是否有人能够帮我修改我的代码,以便按照我的意愿进行操作?
提前致谢。
我正在使用的代码:
$(function(){
$('#background img:gt(0)').hide();
setInterval(function(){
$('#background :first-child').fadeOut()
.next('img').fadeIn()
.end().appendTo('#background');},
3000);
});
答案 0 :(得分:1)
您可以使用JQuery .animate()
水平切换。例如:
$('#background :first-child').animate({width: 'toggle'})
.next('img').animate({width: 'toggle'})
.end().appendTo('#background');},
3000);