버

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


;(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,187건
+
제목 글쓴이 날짜 조회
14-12-27 조회 5,092
14-12-26 조회 4,747
14-12-25 조회 3,539
14-12-24 조회 3,741
14-12-24 조회 6,190
14-12-23 조회 4,093
14-12-23 조회 4,331
14-12-20 조회 3,726
14-12-20 조회 3,446
14-12-20 조회 3,589
14-12-19 조회 4,007
14-12-18 조회 5,548
14-12-18 조회 3,841
14-12-17 조회 4,380
14-12-16 조회 3,854
14-12-16 조회 3,651
14-12-15 조회 6,968
14-12-15 조회 3,792
14-12-14 조회 3,948
14-12-13 조회 3,549
14-12-12 조회 3,923
14-12-12 조회 3,543
14-12-12 조회 3,227
14-12-11 조회 3,152
14-12-11 조회 3,730
14-12-10 조회 3,719
14-12-10 조회 3,705
14-12-10 조회 3,766
14-12-09 조회 3,342
14-12-09 조회 3,460
14-12-08 조회 6,328
14-12-08 조회 4,275
14-12-07 조회 3,047
14-12-07 조회 3,526
14-12-07 조회 3,381
14-12-05 조회 5,059
14-12-05 조회 3,307
14-12-05 조회 3,459
14-12-04 조회 3,172
14-12-03 조회 3,667
14-12-03 조회 3,330
14-12-02 조회 3,560
14-12-02 조회 4,384
14-12-02 조회 3,133
14-12-01 조회 3,119
14-12-01 조회 4,357
14-11-29 조회 4,011
14-11-28 조회 3,960
14-11-27 조회 3,340
14-11-27 조회 4,070
14-11-27 조회 3,612
14-11-26 조회 3,468
14-11-26 조회 3,770
14-11-26 조회 3,872
14-11-25 조회 3,979
14-11-25 조회 3,867
14-11-25 조회 6,770
14-11-24 조회 5,544
14-11-24 조회 3,869
14-11-21 조회 4,204
14-11-20 조회 7,938
14-11-20 조회 4,579
14-11-19 조회 4,019
14-11-18 조회 3,560
14-11-18 조회 4,192
14-11-17 조회 4,116
14-11-16 조회 3,903
14-11-13 조회 3,207
14-11-13 조회 3,514
14-11-13 조회 3,436
14-11-12 조회 3,694
14-11-12 조회 4,172
14-11-12 조회 4,424
14-11-11 조회 3,344
14-11-11 조회 4,075
14-11-09 조회 3,841
14-11-08 조회 3,651
14-11-07 조회 7,785
14-11-06 조회 7,324
14-11-06 조회 3,767
14-11-06 조회 7,250
14-11-05 조회 6,953
14-11-05 조회 7,249
14-11-05 조회 8,105
14-11-04 조회 7,774
14-11-04 조회 7,212
14-11-04 조회 3,549
14-11-03 조회 8,527
14-11-03 조회 4,346
14-10-31 조회 3,894
14-10-31 조회 5,936
14-10-30 조회 3,766
14-10-30 조회 5,843
14-10-30 조회 5,257
14-10-28 조회 4,193
14-10-27 조회 4,366
14-10-27 조회 3,733
14-10-25 조회 5,179
14-10-25 조회 3,768
14-10-25 조회 8,434