Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
向下滚动该页面时,我想更改页面标题中的文本(标题粘在顶部)。每次通过当前 div 的底部时,标题中的文本都会再次更改。这是我想要的一个完美的例子:prss.com。我对 javascript 和 jQuery 很不好,所以如果 annybody 有解决方案...
在此先感谢,贾斯珀
您可以简单地使用 的.scroll()事件jQuery来检测用户滚动,然后根据滚动位置做任何您想做的事情。后一种你可以.scrollTop()使用jQuery.
.scroll()
jQuery
.scrollTop()
这是JSFiddle,它演示了与您提供的功能类似的功能。