상단 텝 메뉴 고정을 했는데..

2018-04-11 (수) 14:01:10 2,519

상단 텝 메뉴 고정을 했는데..

텝 메뉴 클릭할때마다 불러오는 페이지의 높이가 바뀌나여?

<style>
       #prodTabWrapper.fixed {  position: fixed; width:1200px;  top: 0px; margin-top:0px; z-index:1; }
</style>

<script>
$(function () {
    var msie6 = $.browser == 'msie' && $.browser.version < 7;
    if (!msie6) {
    var top = $('#prodTabWrapper').offset().top - parseFloat($('#prodTabWrapper').css('margin-top').replace('/auto/, 0'));
    $(window).scroll(function (event) {
      // what the y position of the scroll is
      var y = $(this).scrollTop();
      
      // whether that's below the form
      if (y >= top) {
        // if so, ad the fixed class
        $('#prodTabWrapper').addClass('fixed');
      } else {
        // otherwise remove it
        $('#prodTabWrapper').removeClass('fixed');
      }
    });
  }  
});
</script>

|

답변 1개

높이를 설정해보세요. height:100px;

Copy
<style>
       #prodTabWrapper.fixed {  position: fixed; width:1200px; height:100px;  top: 0px; margin-top:0px; z-index:1; }
</style>

답변을 작성하려면 로그인이 필요합니다.