버

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


;(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,701
14-05-17 조회 7,120
14-05-15 조회 4,694
14-05-15 조회 5,636
14-05-15 조회 3,857
14-05-13 조회 4,955
14-05-13 조회 7,493
14-05-13 조회 4,620
14-05-13 조회 5,025
14-05-13 조회 3,707
14-05-11 조회 3,779
14-05-11 조회 4,535
14-05-11 조회 4,647
14-05-11 조회 4,670
14-05-09 조회 5,495
14-05-09 조회 4,218
14-05-09 조회 6,444
14-05-09 조회 6,470
14-05-09 조회 5,025
14-05-09 조회 7,789
14-05-09 조회 1.3만
14-05-08 조회 5,813
14-05-08 조회 4,271
14-05-07 조회 6,583
14-05-05 조회 5,678
14-05-01 조회 5,267
14-04-30 조회 4,440
14-04-30 조회 7,434
14-04-29 조회 4,045
14-04-27 조회 4,300
14-04-27 조회 4,948
14-04-26 조회 5,045
14-04-25 조회 5,004
14-04-25 조회 7,777
14-04-22 조회 4,722
14-04-21 조회 3,960
14-04-21 조회 5,093
14-04-17 조회 4,814
14-04-16 조회 5,635
14-04-16 조회 3,940
14-04-16 조회 4,633
14-04-15 조회 4,637
14-04-15 조회 4,569
14-04-15 조회 4,343
14-04-14 조회 4,335
14-04-14 조회 4,308
14-04-14 조회 4,674
14-04-14 조회 4,825
14-04-14 조회 4,819
14-04-13 조회 4,728
14-04-13 조회 5,043
14-04-13 조회 4,267
14-04-12 조회 4,278
14-04-12 조회 4,416
14-04-12 조회 4,520
14-04-11 조회 5,044
14-04-10 조회 4,525
14-04-10 조회 4,677
14-04-10 조회 9,154
14-04-10 조회 4,683
14-04-10 조회 4,795
14-04-10 조회 4,832
14-04-09 조회 4,989
14-04-09 조회 5,361
14-04-08 조회 7,039
14-04-07 조회 5,329
14-04-06 조회 3,972
14-04-06 조회 3,707
14-04-06 조회 3,833
14-04-05 조회 3,917
14-04-05 조회 4,314
14-04-05 조회 1.8만
14-04-02 조회 4,445
14-04-02 조회 3,474
14-04-02 조회 3,498
14-04-02 조회 3,925
14-04-01 조회 6,218
14-03-31 조회 3,820
14-03-31 조회 3,571
14-03-30 조회 3,569
14-03-30 조회 3,409
14-03-30 조회 3,878
14-03-30 조회 4,441
14-03-29 조회 3,375
14-03-29 조회 3,782
14-03-29 조회 4,440
14-03-28 조회 3,292
14-03-28 조회 4,120
14-03-28 조회 3,555
14-03-27 조회 3,697
14-03-26 조회 4,133
14-03-26 조회 4,467
14-03-26 조회 3,360
14-03-26 조회 3,928
14-03-26 조회 3,351
14-03-25 조회 6,556
14-03-25 조회 3,929
14-03-25 조회 4,211
14-03-25 조회 3,972
14-03-25 조회 3,505