버

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


;(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-08-26 조회 7,426
14-08-25 조회 4,220
14-08-23 조회 3,986
14-08-22 조회 4,475
14-08-22 조회 1.1만
14-08-22 조회 4,029
14-08-22 조회 5,287
14-08-22 조회 4,232
14-08-22 조회 4,127
14-08-21 조회 4,284
14-08-21 조회 3,843
14-08-21 조회 3,689
14-08-20 조회 4,027
14-08-20 조회 3,693
14-08-19 조회 4,488
14-08-19 조회 3,715
14-08-19 조회 4,049
14-08-19 조회 3,822
14-08-19 조회 7,569
14-08-19 조회 3,670
14-08-18 조회 3,935
14-08-18 조회 4,458
14-08-18 조회 3,838
14-08-17 조회 8,238
14-08-17 조회 6,519
14-08-17 조회 7,946
14-08-17 조회 3,745
14-08-16 조회 4,297
14-08-16 조회 4,273
14-08-16 조회 4,336
14-08-14 조회 4,084
14-08-14 조회 3,629
14-08-13 조회 6,407
14-08-13 조회 5,968
14-08-13 조회 5,358
14-08-13 조회 4,577
14-08-13 조회 4,456
14-08-13 조회 5,835
14-08-13 조회 3,748
14-08-12 조회 4,113
14-08-12 조회 5,483
14-08-12 조회 6,355
14-08-12 조회 4,229
14-08-12 조회 3,892
14-08-12 조회 4,407
14-08-11 조회 3,749
14-08-11 조회 4,428
14-08-11 조회 3,744
14-08-11 조회 4,436
14-08-11 조회 4,190
14-08-11 조회 5,262
14-08-11 조회 6,984
14-08-11 조회 6,626
14-08-11 조회 6,740
14-08-11 조회 4,650
14-08-11 조회 4,684
14-08-11 조회 5,304
14-08-08 조회 3,964
14-08-08 조회 4,604
14-08-08 조회 6,761
14-08-07 조회 5,335
14-08-07 조회 3,671
14-08-07 조회 4,375
14-08-06 조회 4,191
14-08-06 조회 3,797
14-08-06 조회 6,086
14-08-06 조회 4,636
14-08-06 조회 4,545
14-08-06 조회 4,172
14-08-06 조회 6,436
14-08-06 조회 5,714
14-08-06 조회 4,051
14-08-06 조회 6,602
14-08-06 조회 4,082
14-08-05 조회 3,646
14-08-05 조회 3,943
14-08-05 조회 3,707
14-08-05 조회 3,733
14-08-05 조회 4,069
14-08-04 조회 4,932
14-08-04 조회 4,110
14-08-04 조회 3,699
14-08-03 조회 3,565
14-08-03 조회 5,666
14-08-03 조회 5,076
14-08-03 조회 5,325
14-08-02 조회 4,586
14-08-01 조회 5,708
14-08-01 조회 6,415
14-08-01 조회 7,589
14-08-01 조회 8,855
14-08-01 조회 5,576
14-08-01 조회 4,843
14-08-01 조회 4,771
14-08-01 조회 4,158
14-08-01 조회 4,131
14-08-01 조회 4,250
14-08-01 조회 3,932
14-08-01 조회 4,836
14-08-01 조회 5,217