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


;(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년 전 조회 2,466
11년 전 조회 2,782
11년 전 조회 1,988
11년 전 조회 2,193
11년 전 조회 2,152
11년 전 조회 2,289
11년 전 조회 2,815
11년 전 조회 2,352
11년 전 조회 2,313
11년 전 조회 6,815
11년 전 조회 2,378
11년 전 조회 2,547
11년 전 조회 2,579
11년 전 조회 2,738
11년 전 조회 3,111
11년 전 조회 4,680
11년 전 조회 3,074
11년 전 조회 1,847
11년 전 조회 1,637
11년 전 조회 1,780
11년 전 조회 1,863
11년 전 조회 2,163
11년 전 조회 1.6만
11년 전 조회 2,260
11년 전 조회 1,383
11년 전 조회 1,422
11년 전 조회 1,655
11년 전 조회 3,949
11년 전 조회 1,775
11년 전 조회 1,553
11년 전 조회 1,581
11년 전 조회 1,448
11년 전 조회 1,596
11년 전 조회 2,597
11년 전 조회 1,371
11년 전 조회 1,811
11년 전 조회 2,441
11년 전 조회 1,308
11년 전 조회 2,196
11년 전 조회 1,513
11년 전 조회 1,657
11년 전 조회 2,125
11년 전 조회 2,398
11년 전 조회 1,385
11년 전 조회 1,937
11년 전 조회 1,303
11년 전 조회 4,479
11년 전 조회 1,866
11년 전 조회 2,136
11년 전 조회 1,937
11년 전 조회 1,348
11년 전 조회 1,476
11년 전 조회 1,381
11년 전 조회 6,022
11년 전 조회 1,366
11년 전 조회 1,353
11년 전 조회 3,796
11년 전 조회 1,668
11년 전 조회 5,223
11년 전 조회 2,568
11년 전 조회 3,402
11년 전 조회 1,346
11년 전 조회 1,390
11년 전 조회 2,190
11년 전 조회 1,383
11년 전 조회 2,337
11년 전 조회 2,240
11년 전 조회 5,202
11년 전 조회 1,668
11년 전 조회 2,793
11년 전 조회 2,070
11년 전 조회 2,128
11년 전 조회 2,210
11년 전 조회 1,485
11년 전 조회 2,295
11년 전 조회 1,175
11년 전 조회 4,480
11년 전 조회 2,541
11년 전 조회 2,350
11년 전 조회 2,023
11년 전 조회 7,504
11년 전 조회 1,979
11년 전 조회 1,571
11년 전 조회 3,016
11년 전 조회 2,413
11년 전 조회 1,484
11년 전 조회 1,944
11년 전 조회 3,232
11년 전 조회 2,643
11년 전 조회 2,488
11년 전 조회 2,780
11년 전 조회 3,034
11년 전 조회 3,845
11년 전 조회 3,406
11년 전 조회 3,442
11년 전 조회 4,169
11년 전 조회 3,964
11년 전 조회 1,322
11년 전 조회 4,853
11년 전 조회 5,875