我正在尝试找到一种使用CSS的方法,以便在向下滚动以隐藏顶部的黑条标题(带有联系信息)时,将网站上的主标题导航(带有徽标和链接)向上移动吗?网站是atm.truenorthmediasolutions.ca。谢谢!
答案 0 :(得分:0)
$(window).scroll(function() {
if ($(this).scrollTop() > 200) { //use `this`, not `document`
$('.fixedelement').css({
'display': 'none'
});
}
});
取自here
答案 1 :(得分:0)
INSTALLED_APPS = (
...
'webpush',
)
css
<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>