javascript - 在滚动时隐藏顶部标题并向上移动主标题
问题描述
如果可能的话,我试图找出一种使用 css 的方法,以便在向下滚动以隐藏顶部黑条标题(带有联系信息)时向上移动我网站上的主标题导航(带有徽标和链接)?网站是 atm.truenorthmediasolutions.ca。谢谢!
解决方案
<script type="text/javascript">
$(document).ready(function () {
$(window).scroll(function() {
if ($(this).scrollTop() > 10){
$('.et_pb_section_0_tb_header, #et-main-area').addClass("stickyheader");
}
else{
$('.et_pb_section_0_tb_header, #et-main-area').removeClass("stickyheader");
}
});
});
</script>
css
.stickyheader .et_pb_row_1_tb_header{ display:none;}
.stickyheader .et_pb_row_0_tb_header.et_pb_row{padding-top:0!important; top:0!important;}
.stickyheader .et_pb_image_0_tb_header {top:12px;}
#et-main-area.stickyheader .et_pb_section_0_tb_body,
#et-main-area.stickyheader .et_pb_section_1_tb_body{top:100px;}
推荐阅读
- angular - 在 bsDatepicker 中提交表单后更改日期
- r - 如何重复列表可变次数
- wordpress - 使用帖子计数的帖子的可变宽度
- hibernate - Hibernate - 在单个事务中保存两个对象
- android - 以目标账户的货币设置所有应用内商品的默认价格
- keystore - 如何在 keytool 中传递一些非 ASCII 字符
- google-apps-script - 使用谷歌应用脚本进行数据操作
- python - 如何运行 g:profiler
- java - 使用 SimpleDateFormat Android 无法解析的日期
- android - Maps v3.0.0 Beta 的 Proguard 规则