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


;(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,128
11년 전 조회 3,439
11년 전 조회 2,665
11년 전 조회 2,877
11년 전 조회 2,825
11년 전 조회 2,936
11년 전 조회 3,441
11년 전 조회 3,056
11년 전 조회 3,047
11년 전 조회 7,539
11년 전 조회 3,087
11년 전 조회 3,207
11년 전 조회 3,240
11년 전 조회 3,381
11년 전 조회 3,756
11년 전 조회 5,344
11년 전 조회 3,726
11년 전 조회 2,538
11년 전 조회 2,353
11년 전 조회 2,469
11년 전 조회 2,577
11년 전 조회 2,835
11년 전 조회 1.7만
11년 전 조회 2,923
11년 전 조회 2,075
11년 전 조회 2,127
11년 전 조회 2,385
11년 전 조회 4,645
11년 전 조회 2,451
11년 전 조회 2,215
11년 전 조회 2,277
11년 전 조회 2,131
11년 전 조회 2,278
11년 전 조회 3,074
11년 전 조회 2,057
11년 전 조회 2,469
11년 전 조회 3,126
11년 전 조회 2,010
11년 전 조회 2,824
11년 전 조회 2,173
11년 전 조회 2,308
11년 전 조회 2,788
11년 전 조회 3,076
11년 전 조회 2,013
11년 전 조회 2,617
11년 전 조회 1,961
11년 전 조회 5,101
11년 전 조회 2,562
11년 전 조회 2,767
11년 전 조회 2,569
11년 전 조회 2,011
11년 전 조회 2,143
11년 전 조회 2,037
11년 전 조회 6,526
11년 전 조회 2,029
11년 전 조회 2,003
11년 전 조회 4,450
12년 전 조회 2,311
12년 전 조회 5,856
12년 전 조회 3,227
12년 전 조회 4,038
12년 전 조회 1,982
12년 전 조회 1,996
12년 전 조회 2,849
12년 전 조회 2,037
12년 전 조회 2,998
12년 전 조회 2,950
12년 전 조회 5,868
12년 전 조회 2,345
12년 전 조회 3,476
12년 전 조회 2,727
12년 전 조회 2,796
12년 전 조회 2,868
12년 전 조회 2,110
12년 전 조회 2,961
12년 전 조회 1,805
12년 전 조회 5,102
12년 전 조회 3,170
12년 전 조회 3,003
12년 전 조회 2,619
12년 전 조회 8,122
12년 전 조회 2,576
12년 전 조회 2,197
12년 전 조회 3,683
12년 전 조회 3,003
12년 전 조회 2,119
12년 전 조회 2,501
12년 전 조회 3,870
12년 전 조회 3,275
12년 전 조회 3,103
12년 전 조회 3,390
12년 전 조회 3,676
12년 전 조회 4,437
12년 전 조회 4,006
12년 전 조회 4,101
12년 전 조회 4,784
12년 전 조회 4,585
12년 전 조회 1,947
12년 전 조회 5,458
12년 전 조회 6,505