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


;(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,123
11년 전 조회 3,434
11년 전 조회 2,661
11년 전 조회 2,872
11년 전 조회 2,817
11년 전 조회 2,935
11년 전 조회 3,438
11년 전 조회 3,052
11년 전 조회 3,043
11년 전 조회 7,537
11년 전 조회 3,083
11년 전 조회 3,204
11년 전 조회 3,237
11년 전 조회 3,377
11년 전 조회 3,755
11년 전 조회 5,341
11년 전 조회 3,724
11년 전 조회 2,536
11년 전 조회 2,349
11년 전 조회 2,469
11년 전 조회 2,574
11년 전 조회 2,831
11년 전 조회 1.7만
11년 전 조회 2,921
11년 전 조회 2,071
11년 전 조회 2,126
11년 전 조회 2,384
11년 전 조회 4,639
11년 전 조회 2,446
11년 전 조회 2,212
11년 전 조회 2,273
11년 전 조회 2,129
11년 전 조회 2,277
11년 전 조회 3,068
11년 전 조회 2,055
11년 전 조회 2,465
11년 전 조회 3,122
11년 전 조회 2,006
11년 전 조회 2,821
11년 전 조회 2,168
11년 전 조회 2,301
11년 전 조회 2,783
11년 전 조회 3,071
11년 전 조회 2,008
11년 전 조회 2,614
11년 전 조회 1,957
11년 전 조회 5,098
11년 전 조회 2,558
11년 전 조회 2,762
11년 전 조회 2,564
11년 전 조회 2,009
11년 전 조회 2,139
11년 전 조회 2,033
11년 전 조회 6,523
11년 전 조회 2,025
11년 전 조회 1,998
11년 전 조회 4,447
11년 전 조회 2,310
12년 전 조회 5,854
12년 전 조회 3,222
12년 전 조회 4,034
12년 전 조회 1,977
12년 전 조회 1,989
12년 전 조회 2,842
12년 전 조회 2,032
12년 전 조회 2,994
12년 전 조회 2,947
12년 전 조회 5,864
12년 전 조회 2,337
12년 전 조회 3,475
12년 전 조회 2,725
12년 전 조회 2,790
12년 전 조회 2,863
12년 전 조회 2,103
12년 전 조회 2,956
12년 전 조회 1,804
12년 전 조회 5,100
12년 전 조회 3,167
12년 전 조회 2,998
12년 전 조회 2,613
12년 전 조회 8,119
12년 전 조회 2,569
12년 전 조회 2,196
12년 전 조회 3,678
12년 전 조회 2,999
12년 전 조회 2,116
12년 전 조회 2,499
12년 전 조회 3,865
12년 전 조회 3,275
12년 전 조회 3,102
12년 전 조회 3,388
12년 전 조회 3,671
12년 전 조회 4,433
12년 전 조회 4,000
12년 전 조회 4,098
12년 전 조회 4,780
12년 전 조회 4,580
12년 전 조회 1,942
12년 전 조회 5,456
12년 전 조회 6,504