버

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


;(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-03-24 조회 3,608
14-03-24 조회 3,397
14-03-23 조회 7,985
14-03-22 조회 3,298
14-03-21 조회 3,402
14-03-20 조회 5,910
14-03-19 조회 3,679
14-03-19 조회 7,398
14-03-19 조회 4,789
14-03-18 조회 5,516
14-03-18 조회 3,209
14-03-17 조회 3,301
14-03-17 조회 4,301
14-03-17 조회 3,428
14-03-17 조회 4,431
14-03-17 조회 4,410
14-03-17 조회 7,307
14-03-16 조회 3,776
14-03-16 조회 4,897
14-03-16 조회 4,155
14-03-15 조회 4,177
14-03-15 조회 4,299
14-03-15 조회 3,659
14-03-15 조회 4,399
14-03-15 조회 3,027
14-03-14 조회 6,694
14-03-14 조회 4,605
14-03-14 조회 4,417
14-03-13 조회 3,862
14-03-13 조회 9,436
14-03-13 조회 3,766
14-03-13 조회 3,472
14-03-13 조회 5,359
14-03-13 조회 4,326
14-03-13 조회 3,492
14-03-12 조회 4,009
14-03-12 조회 5,268
14-03-12 조회 4,617
14-03-12 조회 4,418
14-03-12 조회 4,847
14-03-12 조회 4,993
14-03-12 조회 5,924
14-03-12 조회 5,394
14-03-11 조회 5,647
14-03-11 조회 6,257
14-03-11 조회 6,044
14-03-11 조회 3,378
14-03-11 조회 6,844
14-03-11 조회 8,014
14-03-10 조회 3,576
14-03-08 조회 4,801
14-03-07 조회 3,909
14-03-07 조회 3,229
14-03-06 조회 3,689
14-03-06 조회 3,258
14-03-05 조회 5,406
14-03-04 조회 4,161
14-03-04 조회 3,242
14-03-04 조회 3,294
14-03-04 조회 3,750
14-03-03 조회 3,399
14-03-03 조회 3,511
14-03-02 조회 3,201
14-03-02 조회 3,241
14-02-28 조회 3,322
14-02-26 조회 3,204
14-02-26 조회 3,197
14-02-25 조회 3,358
14-02-25 조회 5,895
14-02-24 조회 3,631
14-02-24 조회 2,880
14-02-24 조회 2,918
14-02-24 조회 4,700
14-02-23 조회 3,840
14-02-20 조회 3,278
14-02-20 조회 2,934
14-02-20 조회 3,334
14-02-20 조회 2,936
14-02-18 조회 3,886
14-02-17 조회 3,350
14-02-17 조회 2,823
14-02-17 조회 3,041
14-02-17 조회 4,209
14-02-17 조회 3,860
14-02-17 조회 3,436
14-02-15 조회 2,812
14-02-14 조회 3,388
14-02-14 조회 2,770
14-02-14 조회 4,998
14-02-14 조회 3,705
14-02-14 조회 3,724
14-02-14 조회 2,957
14-02-14 조회 2,735
14-02-14 조회 5,063
14-02-14 조회 3,280
14-02-14 조회 2,760
14-02-14 조회 5,179
14-02-13 조회 2,943
14-02-13 조회 4,928
14-02-12 조회 5,643