[英]Animate a div on scrolling the page
I'm busy with my portfolio and i want to fadein a div when i scroll to the div called: 我忙于我的投资组合,当我滚动到div时,我想淡入一个div:
Page2
第2页
Example: 例:
When i am at the red page, the div called: 当我在红页时,div调用:
image-wrapper
图像包装
has to move.. 必须移动..
I know how to animate, but not how to let it animate at an specific point. 我知道如何制作动画,但不知道如何在特定点制作动画。
I already tried it with an tutorial, but that didn't help :( 我已经用教程尝试过了,但是没有帮助:(
Thanks, 谢谢,
You'll have to check if you are on page2
or not. 你必须检查,如果你在
page2
或没有。 You can do this by checking which part of the page you are on by using onscroll
event. 您可以通过使用
onscroll
事件检查您位于页面的哪一部分来完成此操作。 You can check it by comparing $(window).scrollTop()
and elem.offset().top
or something similar. 您可以通过比较
$(window).scrollTop()
和elem.offset().top
或类似的东西来进行检查。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.