lavenderblush

상단메뉴 고정하기

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" charset="utf-8"></script><!--topmenu_fixed-->
<script type="text/javascript" charset="utf-8">
        $(function() {$(function(){
    var menu = $('#menu'),
        pos = menu.offset();
        
        $(window).scroll(function(){
            if($(this).scrollTop() > pos.top+menu.height() && menu.hasClass('default')){
                menu.fadeOut('fast', function(){
                    $(this).removeClass('default').addClass('fixed').fadeIn('fast');
                });
            } else if($(this).scrollTop() <= pos.top && menu.hasClass('fixed')){
                menu.fadeOut('fast', function(){
                    $(this).removeClass('fixed').addClass('default').fadeIn('fast');
                });
            }
        });
});
});</script>

<style TYPE="text/css">
#navi {}
#menu {text-align: center;margin: 0 auto;padding: 0;}
.fixed {position: fixed;top: -5px;left: 0;width: 100%;
    box-shadow: 0 0 40px #000;
    -webkit-box-shadow: 0 0 40px #000;
    -moz-box-shadow: 0 0 40px #000;
</style> 
 

<div id="navi">
    <div id="menu" class="default">메뉴</div>
   </div>

|

댓글 5개

감사합니다.
감사합니다 :)
워! 정말 감사합니다!!
댓글을 작성하시려면 로그인이 필요합니다.

그누보드5 팁자료실

+
제목 글쓴이 날짜 조회
7년 전 조회 7,530
7년 전 조회 5,514
7년 전 조회 1.8만
7년 전 조회 4,205
7년 전 조회 5,329
7년 전 조회 4,597
7년 전 조회 4,104
7년 전 조회 4,744
7년 전 조회 4,687
7년 전 조회 4,409
7년 전 조회 4,205
7년 전 조회 5,548
7년 전 조회 9,274
7년 전 조회 5,015
7년 전 조회 7,170
7년 전 조회 8,527
7년 전 조회 4,476
7년 전 조회 4,730
7년 전 조회 4,165
7년 전 조회 4,895
7년 전 조회 4,257
7년 전 조회 4,679
7년 전 조회 4,843
7년 전 조회 3,683
7년 전 조회 4,900
7년 전 조회 5,393
7년 전 조회 1.8만
7년 전 조회 3,291
7년 전 조회 4,382
7년 전 조회 5,487
🐛 버그신고