제이쿼리 이부분 어떻게 수정해야할까요??


;(function($) {
 $.fn.gnbmenu = function(options) {
  options = $.extend({
   width:900,
   speed: 500,
   easing: 'easeOutCubic', 
   reset: 2000
  }, options);
  
  return this.each(function() {
   var $nav = $(this),
     $nav_gnb = $(this).find('li'),
     $gnb_img = $('.gnb_img p'),
     $current_item = $(this).find('.focus'),
     $index = 0, $focus_index = 0,
     $autoheight = $('.intro').outerHeight(),
     reset;
   $('#container').css('height',$autoheight);
   $nav_gnb.bind('mouseover focusin', function() {
    $index = $(this).index();
    clearTimeout(reset);
    $gnb_img.animate({
     left: $(this).position().left,
     width: $(this).outerWidth()
    }, {
     duration: options.speed,
     easing: options.easing,
     queue: false
    });
   })
   .bind('mouseover focusin', function() {
    reset = setTimeout(function() {
     $gnb_img.animate({
      left: $current_item.position().left,
      width: $current_item.outerWidth()     
     }, options.speed);
    }, options.reset);
   })
   .click(function(){
    $(this)
     .siblings().removeClass('focus')
     .end().addClass('focus');
    $current_item = $(this);    
    $focus_index = $(this).index();
    if($focus_index == 0){
     $('#wrap').addClass('none');
    }else{
     $('#wrap').removeClass('none');
    }
    $autoheight = $('.contents>div:eq('+ $focus_index +')').outerHeight();
    $('#container').stop().animate({'height':$autoheight},options.speed)
    $('.contents').stop().animate({'left':- options.width * $focus_index
    },options.speed,options.easing);
   })
   $('#header h1').click(function(){
    clicklink(0);
   });
   $('.int>#sol01').click(function(){
    clicklink(3);
   });
   
   
   function clicklink(a){
    $('.focus').removeClass('focus');
    if(a == 0){
     $('#wrap').addClass('none');
    }else{
     $('#wrap').removeClass('none');
    }
    $current_item = $nav.find('li:eq(' + a + ')').addClass('focus');
    $autoheight = $('.contents>div:eq(' + a + ')').outerHeight();
    $('.contents').stop().animate({'left':- options.width * a},options.speed);
    $('#container').stop().animate({'height':$autoheight},options.speed);
    clearTimeout(reset);
    reset = setTimeout(function() {
     $gnb_img.animate({
      left: $current_item.position().left,
      width: $current_item.outerWidth()     
     }, options.speed);
    }, 100);
   };
  });
 }
})(jQuery);

이 쿼리를 해상도가 1024이상일때만 (데스크탑) 실행되게 하려면 어떻게 소스를 수정해야할까요??
|

댓글 1개

if statement 만 하나 넣어주시면 되잖아요.

if (screen.width >= 1024) {
메뉴실행
}

아니면 서버쪽에서 (php 에서) 브라우져 agent detect 하셔서 데스크탑인 경우에만 위 jQuery 를 load 하게 하셔도 되고.
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
11년 전 조회 3,068
11년 전 조회 3,383
11년 전 조회 2,610
11년 전 조회 2,801
11년 전 조회 2,761
11년 전 조회 2,886
11년 전 조회 3,402
11년 전 조회 2,995
11년 전 조회 2,988
11년 전 조회 7,485
11년 전 조회 3,024
11년 전 조회 3,149
11년 전 조회 3,184
11년 전 조회 3,318
11년 전 조회 3,706
11년 전 조회 5,297
11년 전 조회 3,677
11년 전 조회 2,487
11년 전 조회 2,301
11년 전 조회 2,422
11년 전 조회 2,518
11년 전 조회 2,780
11년 전 조회 1.7만
11년 전 조회 2,861
11년 전 조회 2,017
11년 전 조회 2,074
11년 전 조회 2,328
11년 전 조회 4,605
11년 전 조회 2,383
11년 전 조회 2,159
11년 전 조회 2,219
11년 전 조회 2,074
11년 전 조회 2,234
11년 전 조회 3,013
11년 전 조회 2,005
11년 전 조회 2,403
11년 전 조회 3,068
11년 전 조회 1,941
11년 전 조회 2,764
11년 전 조회 2,116
11년 전 조회 2,253
11년 전 조회 2,735
11년 전 조회 3,018
11년 전 조회 1,952
11년 전 조회 2,554
11년 전 조회 1,904
11년 전 조회 5,043
11년 전 조회 2,485
11년 전 조회 2,721
11년 전 조회 2,516
11년 전 조회 1,966
11년 전 조회 2,086
11년 전 조회 1,982
11년 전 조회 6,478
11년 전 조회 1,965
11년 전 조회 1,951
11년 전 조회 4,393
11년 전 조회 2,260
11년 전 조회 5,802
11년 전 조회 3,178
11년 전 조회 3,997
11년 전 조회 1,934
11년 전 조회 1,939
12년 전 조회 2,786
12년 전 조회 1,986
12년 전 조회 2,928
12년 전 조회 2,889
12년 전 조회 5,811
12년 전 조회 2,288
12년 전 조회 3,427
12년 전 조회 2,688
12년 전 조회 2,750
12년 전 조회 2,820
12년 전 조회 2,063
12년 전 조회 2,906
12년 전 조회 1,763
12년 전 조회 5,061
12년 전 조회 3,121
12년 전 조회 2,952
12년 전 조회 2,576
12년 전 조회 8,086
12년 전 조회 2,528
12년 전 조회 2,159
12년 전 조회 3,623
12년 전 조회 2,948
12년 전 조회 2,074
12년 전 조회 2,454
12년 전 조회 3,814
12년 전 조회 3,221
12년 전 조회 3,049
12년 전 조회 3,334
12년 전 조회 3,619
12년 전 조회 4,373
12년 전 조회 3,949
12년 전 조회 4,038
12년 전 조회 4,734
12년 전 조회 4,510
12년 전 조회 1,897
12년 전 조회 5,401
12년 전 조회 6,460