带有jquery的粘性标题 [英] Sticky header with jquery

查看:27
本文介绍了带有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/粘性元素/

作为评论之一的更新,http://stickyjs.com 可能是更受支持的库.

AS an update from one of the comments, http://stickyjs.com might be a more supported library.

这篇关于带有jquery的粘性标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆