1
이봐 등 여기에 본 헤더 막대로 동적 헤더/탐색 모음을 만들려고 메신저동적 헤더 바/네비게이션 바는
$(document).ready(function() {
var lock = $('#header').position().top;
$(window).scroll(function() {
if(lock >= $(window).scrollTop()) {
if($('#header').hasClass('fixed')) {
$('#header').removeClass('fixed');
}
} else {
if(!$('#header').hasClass('fixed')) {
$('#header').addClass('fixed');
}
}
});
});
HTML :
<div id="header" class=""></div>
CSS는 :
#header {
width: 100%;
height: 80px;
background-color: #000;
left:0;
right: 0;
margin-top: 340px;
position: absolute;}
body {
height: 7000px;
width: 100%;
float: right;}
.fixed {
position: fixed;}
도움이 될 것입니다.
필자는 맨 위부터 아래로 스크롤 할 때이 스크립트를 사용할 때 헤더가 사라집니다. –
머리글은 메뉴를 넣을 머리글입니다. 잠시만 기다려주세요. 맞춤 설정하려고합니다. –
제공된 업데이트 코드를 사용하여 jsFiddle을 추가했습니다. –