버

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


;(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-09-19 조회 3,764
14-09-19 조회 4,015
14-09-19 조회 4,399
14-09-19 조회 4,031
14-09-19 조회 4,496
14-09-19 조회 3,960
14-09-19 조회 4,143
14-09-19 조회 4,244
14-09-19 조회 3,982
14-09-19 조회 4,035
14-09-19 조회 4,107
14-09-19 조회 5,064
14-09-19 조회 4,009
14-09-18 조회 4,084
14-09-18 조회 3,939
14-09-18 조회 4,210
14-09-18 조회 4,041
14-09-18 조회 3,733
14-09-18 조회 4,312
14-09-18 조회 4,645
14-09-18 조회 4,295
14-09-18 조회 4,136
14-09-18 조회 4,285
14-09-18 조회 4,995
14-09-18 조회 4,159
14-09-18 조회 4,123
14-09-18 조회 5,546
14-09-18 조회 5,442
14-09-18 조회 4,236
14-09-18 조회 4,739
14-09-18 조회 4,351
14-09-18 조회 4,148
14-09-18 조회 4,345
14-09-18 조회 4,945
14-09-17 조회 4,105
14-09-16 조회 4,911
14-09-16 조회 5,127
14-09-16 조회 3,837
14-09-15 조회 4,037
14-09-15 조회 3,602
14-09-13 조회 4,690
14-09-12 조회 4,504
14-09-12 조회 3,881
14-09-12 조회 3,774
14-09-11 조회 3,500
14-09-11 조회 4,322
14-09-11 조회 4,596
14-09-10 조회 3,426
14-09-10 조회 3,612
14-09-03 조회 3,835
14-09-03 조회 3,769
14-09-03 조회 4,038
14-09-03 조회 5,694
14-09-01 조회 5,484
14-09-01 조회 4,888
14-09-01 조회 4,312
14-08-30 조회 4,345
14-08-30 조회 5,609
14-08-29 조회 4,562
14-08-28 조회 6,040
14-08-28 조회 6,642
14-08-28 조회 6,891
14-08-27 조회 6,915
14-08-27 조회 7,075
14-08-27 조회 5,579
14-08-27 조회 2만
14-08-27 조회 4,251
14-08-26 조회 4,284
14-08-26 조회 4,218
14-08-26 조회 4,087
14-08-26 조회 4,035
14-08-26 조회 3,867
14-08-26 조회 3,735
14-08-26 조회 4,374
14-08-26 조회 4,065
14-08-26 조회 3,995
14-08-26 조회 4,180
14-08-26 조회 4,003
14-08-26 조회 3,862
14-08-26 조회 4,073
14-08-26 조회 4,157
14-08-26 조회 4,160
14-08-26 조회 4,012
14-08-26 조회 3,909
14-08-26 조회 3,863
14-08-26 조회 4,145
14-08-26 조회 3,764
14-08-26 조회 3,907
14-08-26 조회 3,683
14-08-26 조회 3,528
14-08-26 조회 3,863
14-08-26 조회 4,426
14-08-26 조회 3,707
14-08-26 조회 3,850
14-08-26 조회 3,788
14-08-26 조회 3,652
14-08-26 조회 3,811
14-08-26 조회 3,722
14-08-26 조회 3,948
14-08-26 조회 4,435