css - 类似于这种效果如何实现?
本文介绍了css - 类似于这种效果如何实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
1.地址http://www.tuniu.com/journey/...
2.
当没有滚动到玩法概览时正常显示.
当滚动到时玩法概览贴合在顶部。
问题:如何实现?
解决方案
var whenPageLoad = function() {
var body_top = $(window).scrollTop(),
tab_top = dev.offset().top; // 这里是那个dom
if (body_top >= tab_top) {
tab_top .addClass('fixed');
}else{
tab_top .removeClass('fixed');
}
}
whenPageLoad();
$(window).scroll(function() {
whenPageLoad();
});
css-----
.fixed{
position: fixed;
left: 0;
top: 0;
}
这篇关于css - 类似于这种效果如何实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文