与jquery粘头 [英] Sticky header with jquery
问题描述
我想创建多个两个粘性标题,就像在该网站中一样:
http:// www。 trendyol.com/Kappa/ButikDetay/8690
向下滚动时,第一个标题与第二个粘性元素结合在一起。之后,他们俩一起往下走。我该怎么做?
感谢提前支持!
I would like to create multiple two sticky headers just like in that website: http://www.trendyol.com/Kappa/ButikDetay/8690 When you scroll down, the first header combines with the second sticky element. After that, both of them move down together. How can I do it? Thank for advance support!
推荐答案
完成这个任务的方式非常简单。你检查滚动位置,如果它低于某个数字,你会在顶部显示一个固定的位置元素(并隐藏滚动位置备份的位置)。
The way this is accomplished is pretty easy. You check the scroll position and if it is below a certain number you display a fixed position element at the top (and hide when the scroll position goes backup).
说有一个伟大的插件,可以帮助: https://github.com/imakewebthings/jquery-waypoints
That being said there is a great plugin that can help: https://github.com/imakewebthings/jquery-waypoints
随着演示的到来你想要的: http://imakewebthings.com/jquery-waypoints/sticky-elements/
With demo exactly what you want: http://imakewebthings.com/jquery-waypoints/sticky-elements/
作为其中一条评论的更新 http://stickyjs.com 可能是一个更受支持的图书馆。
AS an update from one of the comments, http://stickyjs.com might be a more supported library.
这篇关于与jquery粘头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!