버

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


;(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 하게 하셔도 되고.
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
14-08-01 조회 3,785
14-07-31 조회 3,880
14-07-31 조회 4,727
14-07-30 조회 4,396
14-07-30 조회 4,220
14-07-30 조회 3,961
14-07-30 조회 4,042
14-07-29 조회 6,506
14-07-29 조회 4,353
14-07-28 조회 4,713
14-07-27 조회 4,956
14-07-27 조회 4,141
14-07-26 조회 4,028
14-07-26 조회 4,037
14-07-25 조회 3,482
14-07-25 조회 4,021
14-07-25 조회 4,516
14-07-23 조회 4,492
14-07-23 조회 3,686
14-07-22 조회 4,127
14-07-21 조회 3,642
14-07-21 조회 4,648
14-07-19 조회 4,009
14-07-18 조회 3,387
14-07-18 조회 5,146
14-07-17 조회 9,492
14-07-17 조회 4,123
14-07-17 조회 3,781
14-07-16 조회 3,979
14-07-16 조회 3,535
14-07-16 조회 4,063
14-07-15 조회 3,606
14-07-14 조회 6,187
14-07-13 조회 4,058
14-07-12 조회 4,469
14-07-12 조회 3,852
14-07-11 조회 5,270
14-07-10 조회 4,144
14-07-09 조회 5,554
14-07-08 조회 4,803
14-07-08 조회 5,479
14-07-08 조회 4,267
14-07-08 조회 5,433
14-07-06 조회 4,407
14-07-06 조회 3,778
14-07-05 조회 4,036
14-07-04 조회 8,433
14-07-04 조회 3,948
14-07-04 조회 3,474
14-07-04 조회 3,648
14-07-03 조회 3,795
14-07-03 조회 4,187
14-07-03 조회 4,631
14-07-02 조회 4,975
14-07-02 조회 3,881
14-07-02 조회 4,149
14-07-01 조회 3,917
14-07-01 조회 3,504
14-06-28 조회 5,135
14-06-28 조회 4,412
14-06-28 조회 6,177
14-06-27 조회 3,927
14-06-27 조회 3,786
14-06-27 조회 4,837
14-06-27 조회 5,503
14-06-26 조회 4,900
14-06-26 조회 6,049
14-06-26 조회 4,351
14-06-26 조회 6,418
14-06-26 조회 3,564
14-06-25 조회 3,845
14-06-24 조회 5,283
14-06-24 조회 3,880
14-06-24 조회 5,906
14-06-24 조회 6,045
14-06-24 조회 4,284
14-06-24 조회 4,987
14-06-20 조회 4,049
14-06-20 조회 4,363
14-06-20 조회 3,879
14-06-19 조회 5,095
14-06-18 조회 4,912
14-06-18 조회 4,045
14-06-18 조회 8,365
14-06-12 조회 5,516
14-06-12 조회 6,153
14-06-11 조회 5,067
14-06-10 조회 3,978
14-06-06 조회 5,510
14-06-05 조회 5,345
14-06-04 조회 4,976
14-05-29 조회 4,709
14-05-28 조회 3,873
14-05-27 조회 4,922
14-05-26 조회 5,428
14-05-26 조회 4,226
14-05-23 조회 5,659
14-05-21 조회 4,544
14-05-19 조회 7,488
14-05-18 조회 4,907