버

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


;(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건
+
제목 글쓴이 날짜 조회
13-12-07 조회 3,137
13-12-06 조회 2,653
13-12-06 조회 3,201
13-12-06 조회 2,773
13-12-06 조회 2,988
13-12-06 조회 2,677
13-12-06 조회 3,412
13-12-06 조회 3,740
13-12-06 조회 2,762
13-12-06 조회 2,718
13-12-06 조회 3,804
13-12-05 조회 2,752
13-12-05 조회 3,346
13-12-05 조회 3,205
13-12-05 조회 3,614
13-12-05 조회 3,525
13-12-04 조회 8,337
13-12-03 조회 3,489
13-12-02 조회 2,775
13-12-02 조회 2,627
13-11-30 조회 2,565
13-11-29 조회 2,817
13-11-28 조회 3,036
13-11-27 조회 3,630
13-11-27 조회 3,018
13-11-27 조회 3,401
13-11-27 조회 2,552
13-11-27 조회 2,726
13-11-27 조회 4,768
13-11-26 조회 4,021
13-11-25 조회 3,515
13-11-25 조회 5,323
13-11-23 조회 2,699
13-11-23 조회 4,797
13-11-23 조회 4,351
13-11-23 조회 4,113
13-11-23 조회 4,055
13-11-22 조회 3,068
13-11-22 조회 3,745
13-11-22 조회 3,593
13-11-22 조회 3,144
13-11-22 조회 5,562
13-11-21 조회 2,796
13-11-21 조회 3,286
13-11-20 조회 3,655
13-11-19 조회 4,083
13-11-19 조회 3,088
13-11-19 조회 3,717
13-11-19 조회 3,065
13-11-19 조회 4,829
13-11-18 조회 3,108
13-11-18 조회 2,936
13-11-18 조회 3,249
13-11-18 조회 4,991
13-11-18 조회 4,391
13-11-18 조회 6,852
13-11-18 조회 4,077
13-11-18 조회 4,493
13-11-18 조회 3,861
13-11-18 조회 3,921
13-11-18 조회 3,185
13-11-16 조회 3,214
13-11-15 조회 4,451
13-11-15 조회 3,231
13-11-14 조회 2,981
13-11-14 조회 3,743
13-11-14 조회 4,104
13-11-13 조회 3,219
13-11-13 조회 3,265
13-11-13 조회 3,443
13-11-13 조회 4,323
13-11-13 조회 3,160
13-11-12 조회 3,480
13-11-12 조회 5,696
13-11-07 조회 3,213
13-11-07 조회 3,183
13-11-06 조회 3,136
13-11-05 조회 3,853
13-11-05 조회 3,626
13-11-05 조회 6,664
13-11-05 조회 3,602
13-11-04 조회 3,204
13-11-04 조회 3,222
13-11-04 조회 3,003
13-11-02 조회 3,666
13-11-02 조회 3,304
13-11-01 조회 3,558
13-11-01 조회 2,932
13-11-01 조회 3,070
13-10-31 조회 3,139
13-10-31 조회 3,529
13-10-31 조회 3,930
13-10-31 조회 3,118
13-10-30 조회 3,422
13-10-30 조회 7,694
13-10-30 조회 5,526
13-10-30 조회 3,391
13-10-29 조회 3,225
13-10-29 조회 4,393
13-10-29 조회 3,657