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,593
7년 전 조회 5,568
7년 전 조회 1.9만
7년 전 조회 4,259
7년 전 조회 5,383
7년 전 조회 4,644
7년 전 조회 4,160
7년 전 조회 4,797
7년 전 조회 4,747
7년 전 조회 4,461
7년 전 조회 4,276
7년 전 조회 5,621
7년 전 조회 9,347
7년 전 조회 5,073
7년 전 조회 7,232
7년 전 조회 8,602
7년 전 조회 4,542
7년 전 조회 4,808
7년 전 조회 4,227
7년 전 조회 4,966
7년 전 조회 4,325
7년 전 조회 4,745
7년 전 조회 4,903
7년 전 조회 3,738
7년 전 조회 4,966
7년 전 조회 5,446
7년 전 조회 1.8만
7년 전 조회 3,351
7년 전 조회 4,446
7년 전 조회 5,562