如何使用jquery进行简单的向下滑动div

时间:2022-05-14 19:45:31

Ok, I'm new to jquery and just learning. I have a bunch of div's that I'd like to have sliding down every 2 seconds or so in one box. So for example, maybe a picture of an apple, then replaced with an orange, and so on.... Is there a simple way to do this with jquery? (I don't care about whether the visitors hovers his mouse over the div, or anything like that).

好的,我是jquery的新手,只是学习。我有一堆div,我想在一个盒子里每2秒左右滑下一次。例如,也许是苹果的图片,然后用橙色替换,依此类推......用jquery有一个简单的方法吗? (我不关心访客是否将鼠标悬停在div上,或者类似的东西)。

Thanks!

2 个解决方案

#1


Do you mean the turndown effect here: http://malsup.com/jquery/cycle/? (or even the scrollDown effect on their beginner demos page?)

你的意思是这里的调节效果:http://malsup.com/jquery/cycle/? (甚至是他们的初学者演示页面上的scrollDown效果?)

#2


jQuery has slideDown and SlideUp methods that you could use. For example you could have two or more divs on top of each other (using the appropriate z-index) and then use the above methods to show the appropriate one.

jQuery有你可以使用的slideDown和SlideUp方法。例如,您可以将两个或更多div放在一起(使用适当的z-index),然后使用上述方法显示相应的div。

#1


Do you mean the turndown effect here: http://malsup.com/jquery/cycle/? (or even the scrollDown effect on their beginner demos page?)

你的意思是这里的调节效果:http://malsup.com/jquery/cycle/? (甚至是他们的初学者演示页面上的scrollDown效果?)

#2


jQuery has slideDown and SlideUp methods that you could use. For example you could have two or more divs on top of each other (using the appropriate z-index) and then use the above methods to show the appropriate one.

jQuery有你可以使用的slideDown和SlideUp方法。例如,您可以将两个或更多div放在一起(使用适当的z-index),然后使用上述方法显示相应的div。