진서기

상단메뉴 고정하기

· 2015-12-11 (금) 13:59:55 · 15605 · 9
[code]
$(window).scroll(function () {
var height = $(document).scrollTop();
if (parseInt(height) > 0) {
$('#hd').css({
"position": "fixed",
"display": "block",
"width":"100%",
"z-index" : "10000"
});
$('#wrapper').css({
"padding-top":"116px"
});
} else {
$('.hd').css({
"display": "block",
"position":"relative",
"z-index" : "10000"
});
$('#wrapper').css({
"padding-top":"116px"
});
}
});
[/code]


그누보드 기본 템플릿 기준
|

댓글 9개

미안하지만 저 스크립트를 어느곳에 넣으면될가요
초보가 보기에는 뭘 어덯게 해야 할지 모르겠내요 ....
위의 스크립트를 애래와 같이 <script type="text/javascript">와 </script>로 감싸서
head.php의 적당한 곳에 넣으시면 상단메뉴(헤드부분)가 고정이 됩니다.

--- 아 래 ---

<script type="text/javascript">
$(window).scroll(function () {
var height = $(document).scrollTop();
if (parseInt(height) > 0) {
$('#hd').css({
"position": "fixed",
"display": "block",
"width":"100%",
"z-index" : "10000"
});
$('#wrapper').css({
"padding-top":"116px"
});
} else {
$('.hd').css({
"display": "block",
"position":"relative",
"z-index" : "10000"
});
$('#wrapper').css({
"padding-top":"116px"
});
}
});
</script>
좋은 팁 감사합니다
2016-05-10 (화) 22:21:12
완전 짱짱, 감사합니다!
정말 감사합니다.^^
감사합니다
좋은정보 감사합니다.
정말 고맙습니다.
ㅠㅠ 왜 않될까요??
댓글을 작성하시려면 로그인이 필요합니다.

그누보드5 팁자료실

2,788건
+
제목 글쓴이 날짜 조회
24-12-28 조회 3,567
24-12-26 조회 4,169
24-12-25 조회 3,516
24-12-24 조회 4,058
24-12-24 조회 3,310
24-12-19 조회 3,790
24-12-17 조회 3,598
24-12-17 조회 3,399
24-12-16 조회 3,387
24-12-14 조회 4,015
24-12-14 조회 3,757
24-12-12 조회 3,811
24-12-10 조회 3,569
24-12-03 조회 3,930
24-12-01 조회 3,541
24-11-30 조회 3,652
24-11-29 조회 5,080
24-11-28 조회 3,480
24-11-25 조회 3,289
24-11-22 조회 3,322
24-11-20 조회 3,661
24-11-19 조회 3,291
24-11-16 조회 3,839
24-11-13 조회 3,334
24-11-11 조회 3,811
24-11-09 조회 3,622
24-11-04 조회 4,258
24-11-02 조회 3,641
24-10-28 조회 3,973
24-10-24 조회 4,076