2015-02-09 128 views
0

我对动画背景使用以下脚本,现在图片淡入淡出,但我希望它们水平向左滑动。在jquery中水平滑换幻灯片

我的问题是,这是一个标准的jQuery“功能”,因为我很难找到正确的方法来做到这一点。

是否有人能够帮助我修改我的代码,使其符合我的要求?

在此先感谢。我使用

代码:

$(function(){ 
    $('#background img:gt(0)').hide(); 
    setInterval(function(){ 
     $('#background :first-child').fadeOut() 
     .next('img').fadeIn() 
     .end().appendTo('#background');}, 
     3000); 
}); 
+0

使用'.animate()' – Alex 2015-02-09 15:18:26

+0

将'vertical'向左滑动?你的意思是水平吗? – 2015-02-09 15:34:33

+1

@让 - 保罗...是水平,现在我觉得很愚蠢 – Snowlav 2015-02-09 17:14:59

回答

0

您可以使用jQuery .animate()到水平切换。例如:

$('#background :first-child').animate({width: 'toggle'}) 
    .next('img').animate({width: 'toggle'}) 
    .end().appendTo('#background');}, 
    3000);