버

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


;(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건
+
제목 글쓴이 날짜 조회
14-05-18 조회 5,722
14-05-17 조회 7,129
14-05-15 조회 4,706
14-05-15 조회 5,648
14-05-15 조회 3,873
14-05-13 조회 4,979
14-05-13 조회 7,509
14-05-13 조회 4,632
14-05-13 조회 5,035
14-05-13 조회 3,731
14-05-11 조회 3,794
14-05-11 조회 4,557
14-05-11 조회 4,661
14-05-11 조회 4,683
14-05-09 조회 5,505
14-05-09 조회 4,234
14-05-09 조회 6,456
14-05-09 조회 6,488
14-05-09 조회 5,042
14-05-09 조회 7,801
14-05-09 조회 1.3만
14-05-08 조회 5,824
14-05-08 조회 4,287
14-05-07 조회 6,593
14-05-05 조회 5,689
14-05-01 조회 5,277
14-04-30 조회 4,449
14-04-30 조회 7,449
14-04-29 조회 4,064
14-04-27 조회 4,317
14-04-27 조회 4,971
14-04-26 조회 5,063
14-04-25 조회 5,016
14-04-25 조회 7,795
14-04-22 조회 4,739
14-04-21 조회 3,978
14-04-21 조회 5,104
14-04-17 조회 4,830
14-04-16 조회 5,647
14-04-16 조회 3,948
14-04-16 조회 4,639
14-04-15 조회 4,651
14-04-15 조회 4,581
14-04-15 조회 4,351
14-04-14 조회 4,342
14-04-14 조회 4,318
14-04-14 조회 4,686
14-04-14 조회 4,835
14-04-14 조회 4,828
14-04-13 조회 4,736
14-04-13 조회 5,054
14-04-13 조회 4,277
14-04-12 조회 4,286
14-04-12 조회 4,422
14-04-12 조회 4,538
14-04-11 조회 5,055
14-04-10 조회 4,537
14-04-10 조회 4,687
14-04-10 조회 9,165
14-04-10 조회 4,693
14-04-10 조회 4,805
14-04-10 조회 4,846
14-04-09 조회 4,999
14-04-09 조회 5,375
14-04-08 조회 7,049
14-04-07 조회 5,341
14-04-06 조회 3,984
14-04-06 조회 3,723
14-04-06 조회 3,849
14-04-05 조회 3,924
14-04-05 조회 4,328
14-04-05 조회 1.8만
14-04-02 조회 4,457
14-04-02 조회 3,489
14-04-02 조회 3,507
14-04-02 조회 3,934
14-04-01 조회 6,229
14-03-31 조회 3,827
14-03-31 조회 3,580
14-03-30 조회 3,579
14-03-30 조회 3,415
14-03-30 조회 3,886
14-03-30 조회 4,445
14-03-29 조회 3,379
14-03-29 조회 3,789
14-03-29 조회 4,450
14-03-28 조회 3,297
14-03-28 조회 4,130
14-03-28 조회 3,559
14-03-27 조회 3,702
14-03-26 조회 4,142
14-03-26 조회 4,477
14-03-26 조회 3,370
14-03-26 조회 3,939
14-03-26 조회 3,366
14-03-25 조회 6,564
14-03-25 조회 3,936
14-03-25 조회 4,219
14-03-25 조회 3,986
14-03-25 조회 3,516