버

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


;(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-02-12 조회 3,951
14-02-12 조회 3,014
14-02-12 조회 2,674
14-02-11 조회 3,044
14-02-11 조회 3,158
14-02-11 조회 2,934
14-02-10 조회 6,023
14-02-09 조회 2,747
14-02-08 조회 2,735
14-02-07 조회 2,733
14-02-07 조회 6,872
14-02-06 조회 2,787
14-02-06 조회 3,212
14-02-05 조회 2,990
14-02-05 조회 2,876
14-02-05 조회 3,805
14-02-05 조회 3,678
14-02-04 조회 2,810
14-02-04 조회 3,593
14-02-02 조회 3,215
14-02-01 조회 2,909
14-01-31 조회 2,787
14-01-29 조회 3,693
14-01-29 조회 3,166
14-01-29 조회 3,804
14-01-28 조회 4,842
14-01-28 조회 2,712
14-01-27 조회 2,984
14-01-27 조회 3,088
14-01-27 조회 5,588
14-01-27 조회 3,268
14-01-26 조회 3,779
14-01-25 조회 3,224
14-01-24 조회 2,770
14-01-24 조회 2,929
14-01-24 조회 3,664
14-01-22 조회 2,868
14-01-22 조회 3,032
14-01-22 조회 4,247
14-01-22 조회 3,626
14-01-22 조회 3,445
14-01-22 조회 3,428
14-01-21 조회 3,267
14-01-21 조회 3,325
14-01-20 조회 3,165
14-01-20 조회 3,573
14-01-20 조회 2,752
14-01-20 조회 3,000
14-01-19 조회 2,930
14-01-19 조회 3,498
14-01-18 조회 2,710
14-01-18 조회 3,381
14-01-16 조회 3,377
14-01-16 조회 2,598
14-01-16 조회 3,448
14-01-15 조회 4,050
14-01-15 조회 3,523
14-01-15 조회 3,736
14-01-14 조회 3,199
14-01-14 조회 2,572
14-01-13 조회 2,631
14-01-10 조회 4,902
14-01-10 조회 2,729
14-01-09 조회 2,502
14-01-09 조회 3,088
14-01-07 조회 3,118
14-01-07 조회 3,098
14-01-07 조회 2,885
14-01-06 조회 4,201
14-01-03 조회 4,510
14-01-03 조회 3,175
14-01-03 조회 2,761
14-01-03 조회 4,692
14-01-03 조회 1만
14-01-03 조회 4,404
14-01-02 조회 2,868
14-01-02 조회 3,319
13-12-27 조회 3,112
13-12-27 조회 4,226
13-12-27 조회 4,079
13-12-27 조회 2,645
13-12-27 조회 2,880
13-12-26 조회 4,028
13-12-24 조회 3,283
13-12-20 조회 2,889
13-12-20 조회 2,552
13-12-19 조회 3,327
13-12-19 조회 3,098
13-12-18 조회 3,793
13-12-18 조회 2,781
13-12-18 조회 2,804
13-12-17 조회 3,410
13-12-13 조회 2,870
13-12-12 조회 2,846
13-12-11 조회 3,316
13-12-10 조회 3,206
13-12-09 조회 3,346
13-12-09 조회 3,682
13-12-09 조회 2,854
13-12-08 조회 3,030