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,614
7년 전 조회 5,581
7년 전 조회 1.9만
7년 전 조회 4,276
7년 전 조회 5,399
7년 전 조회 4,656
7년 전 조회 4,174
7년 전 조회 4,807
7년 전 조회 4,760
7년 전 조회 4,475
7년 전 조회 4,289
7년 전 조회 5,636
7년 전 조회 9,362
7년 전 조회 5,083
7년 전 조회 7,249
7년 전 조회 8,619
7년 전 조회 4,556
7년 전 조회 4,827
7년 전 조회 4,240
7년 전 조회 4,978
7년 전 조회 4,340
7년 전 조회 4,759
7년 전 조회 4,915
7년 전 조회 3,749
7년 전 조회 4,975
7년 전 조회 5,463
7년 전 조회 1.8만
7년 전 조회 3,363
7년 전 조회 4,456
7년 전 조회 5,571