버

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


;(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,619
14-05-17 조회 7,025
14-05-15 조회 4,620
14-05-15 조회 5,549
14-05-15 조회 3,768
14-05-13 조회 4,868
14-05-13 조회 7,403
14-05-13 조회 4,534
14-05-13 조회 4,942
14-05-13 조회 3,637
14-05-11 조회 3,722
14-05-11 조회 4,483
14-05-11 조회 4,591
14-05-11 조회 4,592
14-05-09 조회 5,403
14-05-09 조회 4,134
14-05-09 조회 6,364
14-05-09 조회 6,391
14-05-09 조회 4,951
14-05-09 조회 7,713
14-05-09 조회 1.3만
14-05-08 조회 5,727
14-05-08 조회 4,169
14-05-07 조회 6,500
14-05-05 조회 5,601
14-05-01 조회 5,185
14-04-30 조회 4,341
14-04-30 조회 7,346
14-04-29 조회 3,947
14-04-27 조회 4,198
14-04-27 조회 4,851
14-04-26 조회 4,941
14-04-25 조회 4,901
14-04-25 조회 7,673
14-04-22 조회 4,631
14-04-21 조회 3,879
14-04-21 조회 5,008
14-04-17 조회 4,729
14-04-16 조회 5,565
14-04-16 조회 3,866
14-04-16 조회 4,558
14-04-15 조회 4,567
14-04-15 조회 4,520
14-04-15 조회 4,286
14-04-14 조회 4,264
14-04-14 조회 4,231
14-04-14 조회 4,615
14-04-14 조회 4,761
14-04-14 조회 4,747
14-04-13 조회 4,643
14-04-13 조회 4,971
14-04-13 조회 4,193
14-04-12 조회 4,208
14-04-12 조회 4,355
14-04-12 조회 4,465
14-04-11 조회 4,993
14-04-10 조회 4,466
14-04-10 조회 4,608
14-04-10 조회 9,076
14-04-10 조회 4,620
14-04-10 조회 4,721
14-04-10 조회 4,763
14-04-09 조회 4,913
14-04-09 조회 5,280
14-04-08 조회 6,944
14-04-07 조회 5,235
14-04-06 조회 3,885
14-04-06 조회 3,631
14-04-06 조회 3,771
14-04-05 조회 3,853
14-04-05 조회 4,261
14-04-05 조회 1.8만
14-04-02 조회 4,397
14-04-02 조회 3,408
14-04-02 조회 3,436
14-04-02 조회 3,867
14-04-01 조회 6,161
14-03-31 조회 3,769
14-03-31 조회 3,524
14-03-30 조회 3,532
14-03-30 조회 3,374
14-03-30 조회 3,840
14-03-30 조회 4,394
14-03-29 조회 3,325
14-03-29 조회 3,733
14-03-29 조회 4,397
14-03-28 조회 3,258
14-03-28 조회 4,080
14-03-28 조회 3,511
14-03-27 조회 3,652
14-03-26 조회 4,096
14-03-26 조회 4,431
14-03-26 조회 3,320
14-03-26 조회 3,894
14-03-26 조회 3,317
14-03-25 조회 6,515
14-03-25 조회 3,880
14-03-25 조회 4,165
14-03-25 조회 3,922
14-03-25 조회 3,451