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


;(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,083
11년 전 조회 3,400
11년 전 조회 2,629
11년 전 조회 2,830
11년 전 조회 2,785
11년 전 조회 2,900
11년 전 조회 3,413
11년 전 조회 3,015
11년 전 조회 3,008
11년 전 조회 7,498
11년 전 조회 3,043
11년 전 조회 3,174
11년 전 조회 3,204
11년 전 조회 3,333
11년 전 조회 3,724
11년 전 조회 5,315
11년 전 조회 3,698
11년 전 조회 2,498
11년 전 조회 2,310
11년 전 조회 2,437
11년 전 조회 2,530
11년 전 조회 2,800
11년 전 조회 1.7만
11년 전 조회 2,885
11년 전 조회 2,035
11년 전 조회 2,094
11년 전 조회 2,342
11년 전 조회 4,616
11년 전 조회 2,401
11년 전 조회 2,174
11년 전 조회 2,230
11년 전 조회 2,087
11년 전 조회 2,248
11년 전 조회 3,029
11년 전 조회 2,019
11년 전 조회 2,422
11년 전 조회 3,081
11년 전 조회 1,963
11년 전 조회 2,772
11년 전 조회 2,127
11년 전 조회 2,264
11년 전 조회 2,744
11년 전 조회 3,030
11년 전 조회 1,972
11년 전 조회 2,568
11년 전 조회 1,922
11년 전 조회 5,062
11년 전 조회 2,503
11년 전 조회 2,730
11년 전 조회 2,534
11년 전 조회 1,982
11년 전 조회 2,099
11년 전 조회 2,000
11년 전 조회 6,490
11년 전 조회 1,985
11년 전 조회 1,968
11년 전 조회 4,410
11년 전 조회 2,281
11년 전 조회 5,813
11년 전 조회 3,188
11년 전 조회 4,010
11년 전 조회 1,947
12년 전 조회 1,952
12년 전 조회 2,803
12년 전 조회 2,002
12년 전 조회 2,946
12년 전 조회 2,911
12년 전 조회 5,830
12년 전 조회 2,304
12년 전 조회 3,441
12년 전 조회 2,701
12년 전 조회 2,762
12년 전 조회 2,831
12년 전 조회 2,074
12년 전 조회 2,923
12년 전 조회 1,771
12년 전 조회 5,064
12년 전 조회 3,132
12년 전 조회 2,971
12년 전 조회 2,583
12년 전 조회 8,095
12년 전 조회 2,538
12년 전 조회 2,170
12년 전 조회 3,637
12년 전 조회 2,960
12년 전 조회 2,087
12년 전 조회 2,467
12년 전 조회 3,825
12년 전 조회 3,231
12년 전 조회 3,060
12년 전 조회 3,349
12년 전 조회 3,630
12년 전 조회 4,385
12년 전 조회 3,965
12년 전 조회 4,053
12년 전 조회 4,742
12년 전 조회 4,526
12년 전 조회 1,909
12년 전 조회 5,411
12년 전 조회 6,472