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


;(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,843
11년 전 조회 3,173
11년 전 조회 2,385
11년 전 조회 2,541
11년 전 조회 2,511
11년 전 조회 2,643
11년 전 조회 3,147
11년 전 조회 2,730
11년 전 조회 2,745
11년 전 조회 7,212
11년 전 조회 2,774
11년 전 조회 2,902
11년 전 조회 2,951
11년 전 조회 3,078
11년 전 조회 3,469
11년 전 조회 5,057
11년 전 조회 3,470
11년 전 조회 2,254
11년 전 조회 2,040
11년 전 조회 2,170
11년 전 조회 2,262
11년 전 조회 2,549
11년 전 조회 1.7만
11년 전 조회 2,650
11년 전 조회 1,766
11년 전 조회 1,791
11년 전 조회 2,087
11년 전 조회 4,397
11년 전 조회 2,148
11년 전 조회 1,929
11년 전 조회 1,973
11년 전 조회 1,851
11년 전 조회 2,027
11년 전 조회 2,826
11년 전 조회 1,766
11년 전 조회 2,182
11년 전 조회 2,851
11년 전 조회 1,722
11년 전 조회 2,575
11년 전 조회 1,925
11년 전 조회 2,064
11년 전 조회 2,527
11년 전 조회 2,807
11년 전 조회 1,755
11년 전 조회 2,323
11년 전 조회 1,696
11년 전 조회 4,871
11년 전 조회 2,268
11년 전 조회 2,544
11년 전 조회 2,306
11년 전 조회 1,751
11년 전 조회 1,885
11년 전 조회 1,767
11년 전 조회 6,268
11년 전 조회 1,750
11년 전 조회 1,750
11년 전 조회 4,186
11년 전 조회 2,042
11년 전 조회 5,602
11년 전 조회 2,975
11년 전 조회 3,801
11년 전 조회 1,726
11년 전 조회 1,752
11년 전 조회 2,602
11년 전 조회 1,795
11년 전 조회 2,745
11년 전 조회 2,681
11년 전 조회 5,596
11년 전 조회 2,085
11년 전 조회 3,213
11년 전 조회 2,481
11년 전 조회 2,550
11년 전 조회 2,633
11년 전 조회 1,865
11년 전 조회 2,706
11년 전 조회 1,558
11년 전 조회 4,882
11년 전 조회 2,931
11년 전 조회 2,762
11년 전 조회 2,400
11년 전 조회 7,890
11년 전 조회 2,342
11년 전 조회 1,962
11년 전 조회 3,419
11년 전 조회 2,791
11년 전 조회 1,890
11년 전 조회 2,319
11년 전 조회 3,630
11년 전 조회 3,030
11년 전 조회 2,857
11년 전 조회 3,163
11년 전 조회 3,430
11년 전 조회 4,194
11년 전 조회 3,796
11년 전 조회 3,844
11년 전 조회 4,545
11년 전 조회 4,326
11년 전 조회 1,725
11년 전 조회 5,220
11년 전 조회 6,282