버

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


;(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-10-25 조회 5,212
14-10-25 조회 6,406
14-10-25 조회 3,818
14-10-25 조회 3,970
14-10-24 조회 3,924
14-10-23 조회 4,539
14-10-22 조회 3,682
14-10-22 조회 4,359
14-10-22 조회 7,204
14-10-22 조회 4,910
14-10-22 조회 4,859
14-10-22 조회 9,023
14-10-19 조회 4,786
14-10-18 조회 5,754
14-10-17 조회 5,270
14-10-17 조회 4,049
14-10-17 조회 6,133
14-10-17 조회 5,526
14-10-17 조회 9,054
14-10-17 조회 6,532
14-10-17 조회 4,827
14-10-17 조회 5,148
14-10-14 조회 3,368
14-10-14 조회 4,285
14-10-13 조회 3,848
14-10-13 조회 6,528
14-10-13 조회 4,465
14-10-13 조회 4,361
14-10-13 조회 4,560
14-10-11 조회 6,729
14-10-11 조회 6,636
14-10-11 조회 6,519
14-10-10 조회 4,022
14-10-10 조회 6,477
14-10-10 조회 5,756
14-10-10 조회 6,334
14-10-10 조회 3,590
14-10-10 조회 5,507
14-10-10 조회 5,511
14-10-10 조회 5,582
14-10-10 조회 4,500
14-10-10 조회 4,994
14-10-10 조회 4,287
14-10-10 조회 4,136
14-10-08 조회 4,672
14-10-08 조회 3,787
14-10-08 조회 7,007
14-10-07 조회 6,219
14-10-07 조회 4,546
14-10-07 조회 5,571
14-10-07 조회 3,761
14-10-07 조회 4,743
14-10-07 조회 6,410
14-10-06 조회 6,766
14-10-06 조회 7,547
14-10-05 조회 3,753
14-10-04 조회 5,040
14-10-03 조회 6,355
14-10-02 조회 3,926
14-09-29 조회 4,118
14-09-29 조회 4,576
14-09-28 조회 3,900
14-09-27 조회 5,244
14-09-27 조회 4,699
14-09-26 조회 6,786
14-09-26 조회 5,219
14-09-25 조회 7,560
14-09-25 조회 4,069
14-09-25 조회 4,077
14-09-24 조회 4,873
14-09-24 조회 4,830
14-09-24 조회 4,327
14-09-24 조회 3,891
14-09-24 조회 4,511
14-09-24 조회 3,985
14-09-23 조회 4,159
14-09-23 조회 4,278
14-09-23 조회 4,059
14-09-22 조회 3,935
14-09-22 조회 4,860
14-09-22 조회 4,966
14-09-22 조회 6,184
14-09-22 조회 4,146
14-09-22 조회 3,828
14-09-22 조회 3,908
14-09-21 조회 5,843
14-09-21 조회 4,620
14-09-21 조회 4,453
14-09-21 조회 3,936
14-09-21 조회 4,496
14-09-21 조회 4,383
14-09-21 조회 4,064
14-09-20 조회 4,041
14-09-20 조회 3,946
14-09-20 조회 3,850
14-09-20 조회 4,576
14-09-20 조회 4,027
14-09-19 조회 3,937
14-09-19 조회 4,107
14-09-19 조회 4,315