버

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


;(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-08-07 조회 3,341
13-08-06 조회 3,291
13-08-06 조회 4,328
13-08-05 조회 4,744
13-08-02 조회 3,580
13-08-01 조회 3,388
13-08-01 조회 4,097
13-07-30 조회 4,135
13-07-29 조회 3,297
13-07-29 조회 3,993
13-07-27 조회 4,240
13-07-26 조회 3,475
13-07-25 조회 4,062
13-07-25 조회 6,789
13-07-25 조회 4,199
13-07-24 조회 3,868
13-07-24 조회 3,612
13-07-24 조회 4,021
13-07-23 조회 4,475
13-07-23 조회 7,449
13-07-23 조회 8,565
13-07-23 조회 3,617
13-07-23 조회 5,242
13-07-23 조회 9,842
13-07-23 조회 5,476
13-07-23 조회 1.2만
13-07-19 조회 3,311
13-07-18 조회 3,431
13-07-16 조회 4,254
13-07-15 조회 4,613
13-07-15 조회 4,063
13-07-14 조회 4,743
13-07-14 조회 5,121
13-07-14 조회 6,076
13-07-14 조회 5,365
13-07-14 조회 5,515
13-07-14 조회 5,481
13-07-14 조회 4,785
13-07-14 조회 4,377
13-07-14 조회 4,238
13-07-14 조회 4,289
13-07-14 조회 5,032
13-07-14 조회 4,737
13-07-14 조회 4,445
13-07-14 조회 5,497
13-07-14 조회 5,401
13-07-14 조회 5,176
13-07-14 조회 4,888
13-07-14 조회 5,583
13-07-13 조회 3,844
13-07-12 조회 3,684
13-07-12 조회 3,354
13-07-12 조회 3,637
13-07-11 조회 4,206
13-07-11 조회 5,182
13-07-11 조회 5,608
13-07-11 조회 4,554
13-07-11 조회 4,237
13-07-11 조회 4,032
13-07-11 조회 1.3만
13-07-10 조회 3,783
13-07-10 조회 4,799
13-07-09 조회 4,241
13-07-09 조회 4,817
13-07-09 조회 5,080
13-07-08 조회 4,267
13-07-08 조회 4,794
13-07-07 조회 5,544
13-07-05 조회 4,356
13-07-04 조회 4,411
13-07-04 조회 4,350
13-07-04 조회 1.1만
13-07-04 조회 4,447
13-07-04 조회 4,262
13-07-04 조회 5,063
13-07-04 조회 4,134
13-07-04 조회 4,579
13-07-04 조회 4,198
13-07-04 조회 4,313
13-07-03 조회 6,037
13-07-01 조회 1.4만
13-07-01 조회 5,860
13-07-01 조회 5,940
13-07-01 조회 4,027
13-07-01 조회 5,534
13-07-01 조회 3,895
13-07-01 조회 4,817
13-07-01 조회 3,862
13-07-01 조회 4,651
13-07-01 조회 4,301
13-07-01 조회 4,720
13-07-01 조회 6,916
13-06-28 조회 5,146
13-06-28 조회 4,055
13-06-24 조회 8,620
13-06-24 조회 4,499
13-06-23 조회 4,492
13-06-21 조회 6,454
13-06-20 조회 4,764
13-06-19 조회 8,339