버

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


;(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건
+
제목 글쓴이 날짜 조회
12-08-29 조회 4,199
12-08-07 조회 3,861
12-08-03 조회 3,666
12-07-31 조회 3,769
12-07-30 조회 3,719
12-07-16 조회 3,918
12-07-15 조회 3,754
12-07-07 조회 3,610
12-07-06 조회 3,815
12-07-03 조회 3,770
12-06-29 조회 3,399
12-06-22 조회 3,766
12-06-17 조회 4,029
12-05-21 조회 3,945
12-05-02 조회 3,467
12-05-02 조회 4,258
12-05-02 조회 3,379
12-04-30 조회 3,580
12-04-30 조회 3,261
12-03-17 조회 4,136
12-03-10 조회 3,459
12-03-08 조회 3,993
12-03-03 조회 3,695
12-02-27 조회 5,113
12-02-17 조회 4,411
12-02-16 조회 4,687
12-02-03 조회 3,349
12-01-31 조회 3,259
12-01-24 조회 3,259
12-01-17 조회 3,963
12-01-05 조회 3,509
11-12-30 조회 3,240
11-12-23 조회 4,792
11-12-08 조회 3,568
11-12-07 조회 4,521
11-11-27 조회 3,957
11-11-25 조회 4,280
11-11-23 조회 3,720
11-11-22 조회 3,579
11-11-09 조회 3,286
11-10-23 조회 3,227
11-10-19 조회 3,190
11-10-08 조회 2,868
11-10-04 조회 2,868
11-10-04 조회 5,328
11-09-01 조회 4,401
11-08-13 조회 2,577
11-08-06 조회 3,262
11-07-11 조회 3,653
11-06-27 조회 3,012
11-06-21 조회 2,680
11-06-13 조회 2,483
11-06-07 조회 2,494
11-05-26 조회 2,450
11-04-20 조회 2,782
11-03-21 조회 2,878
11-03-18 조회 2,574
11-03-11 조회 2,589
11-02-07 조회 2,421
11-01-18 조회 2,745
11-01-12 조회 2,463
11-01-06 조회 2,554
10-12-10 조회 2,812
10-12-09 조회 2,664
10-12-08 조회 5,094
10-11-29 조회 2,928
10-11-28 조회 2,835
10-11-28 조회 2,664
10-11-19 조회 2,863
10-11-04 조회 2,739
10-10-21 조회 2,462
10-10-19 조회 3,422
10-10-12 조회 2,743
10-10-07 조회 2,581
10-09-30 조회 3,535
10-09-17 조회 3,951
10-09-17 조회 3,890
10-05-31 조회 3,608
09-12-31 조회 3,741
09-07-23 조회 5,062
08-09-16 조회 3,263
08-09-06 조회 3,006
08-09-04 조회 3,428
08-08-16 조회 4,457
08-08-15 조회 3,327
08-08-14 조회 4,543
08-08-12 조회 4,005
08-07-23 조회 2,823
08-07-10 조회 3,777
08-07-04 조회 3,003
08-06-27 조회 7,639
08-06-19 조회 4,951
08-05-27 조회 5,561
08-05-25 조회 5,393
08-05-23 조회 3,470
08-05-23 조회 4,636
08-05-21 조회 4,986
08-05-20 조회 4,098
08-05-20 조회 3,322
08-04-18 조회 4,400