버

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


;(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,188건
+
제목 글쓴이 날짜 조회
14-05-18 조회 5,582
14-05-17 조회 6,885
14-05-15 조회 4,580
14-05-15 조회 5,510
14-05-15 조회 3,725
14-05-13 조회 4,819
14-05-13 조회 7,357
14-05-13 조회 4,479
14-05-13 조회 4,904
14-05-13 조회 3,598
14-05-11 조회 3,677
14-05-11 조회 4,441
14-05-11 조회 4,548
14-05-11 조회 4,527
14-05-09 조회 5,354
14-05-09 조회 4,095
14-05-09 조회 6,311
14-05-09 조회 6,343
14-05-09 조회 4,894
14-05-09 조회 7,653
14-05-09 조회 1.3만
14-05-08 조회 5,673
14-05-08 조회 4,128
14-05-07 조회 6,439
14-05-05 조회 5,536
14-05-01 조회 5,056
14-04-30 조회 4,210
14-04-30 조회 7,284
14-04-29 조회 3,881
14-04-27 조회 4,133
14-04-27 조회 4,698
14-04-26 조회 4,889
14-04-25 조회 4,855
14-04-25 조회 7,632
14-04-22 조회 4,577
14-04-21 조회 3,826
14-04-21 조회 4,952
14-04-17 조회 4,677
14-04-16 조회 5,530
14-04-16 조회 3,827
14-04-16 조회 4,520
14-04-15 조회 4,525
14-04-15 조회 4,463
14-04-15 조회 4,234
14-04-14 조회 4,218
14-04-14 조회 4,184
14-04-14 조회 4,570
14-04-14 조회 4,717
14-04-14 조회 4,716
14-04-13 조회 4,602
14-04-13 조회 4,877
14-04-13 조회 4,132
14-04-12 조회 4,152
14-04-12 조회 4,316
14-04-12 조회 4,418
14-04-11 조회 4,942
14-04-10 조회 4,425
14-04-10 조회 4,555
14-04-10 조회 9,022
14-04-10 조회 4,577
14-04-10 조회 4,681
14-04-10 조회 4,725
14-04-09 조회 4,864
14-04-09 조회 5,227
14-04-08 조회 6,899
14-04-07 조회 5,193
14-04-06 조회 3,848
14-04-06 조회 3,588
14-04-06 조회 3,741
14-04-05 조회 3,811
14-04-05 조회 4,217
14-04-05 조회 1.8만
14-04-02 조회 4,366
14-04-02 조회 3,380
14-04-02 조회 3,398
14-04-02 조회 3,837
14-04-01 조회 6,119
14-03-31 조회 3,724
14-03-31 조회 3,492
14-03-30 조회 3,506
14-03-30 조회 3,351
14-03-30 조회 3,810
14-03-30 조회 4,363
14-03-29 조회 3,303
14-03-29 조회 3,711
14-03-29 조회 4,372
14-03-28 조회 3,224
14-03-28 조회 4,059
14-03-28 조회 3,485
14-03-27 조회 3,631
14-03-26 조회 4,076
14-03-26 조회 4,404
14-03-26 조회 3,299
14-03-26 조회 3,870
14-03-26 조회 3,289
14-03-25 조회 6,466
14-03-25 조회 3,854
14-03-25 조회 4,131
14-03-25 조회 3,827
14-03-25 조회 3,414