버

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


;(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건
+
제목 글쓴이 날짜 조회
15-11-05 조회 2,909
15-11-05 조회 3,764
15-11-04 조회 2,864
15-11-04 조회 2,912
15-11-04 조회 2,793
15-11-04 조회 3,002
15-11-04 조회 3,430
15-11-04 조회 3,258
15-11-03 조회 3,173
15-11-03 조회 3,581
15-11-03 조회 3,124
15-11-02 조회 3,183
15-11-02 조회 2,750
15-11-02 조회 3,075
15-11-02 조회 2,812
15-11-02 조회 2,910
15-11-01 조회 3,058
15-10-31 조회 2,664
15-10-30 조회 3,390
15-10-30 조회 2,776
15-10-29 조회 3,106
15-10-29 조회 2,823
15-10-27 조회 2,935
15-10-26 조회 3,424
15-10-23 조회 2,885
15-10-23 조회 2,923
15-10-21 조회 2,686
15-10-19 조회 4,237
15-10-19 조회 3,332
15-10-18 조회 2,983
15-10-17 조회 3,047
15-10-17 조회 2,866
15-10-17 조회 2,994
15-10-15 조회 3,682
15-10-14 조회 3,561
15-10-07 조회 4,328
15-10-06 조회 3,411
15-10-05 조회 3,260
15-10-05 조회 3,658
15-10-05 조회 2,893
15-10-05 조회 2,985
15-10-05 조회 2,992
15-10-04 조회 2,775
15-10-04 조회 2,923
15-10-04 조회 3,064
15-10-03 조회 3,814
15-10-03 조회 2,906
15-10-02 조회 3,332
15-10-02 조회 3,185
15-10-02 조회 3,161
15-10-02 조회 2,862
15-10-01 조회 2,925
15-10-01 조회 2,970
15-10-01 조회 2,850
15-10-01 조회 2,809
15-10-01 조회 3,144
15-09-30 조회 2,750
15-09-30 조회 2,873
15-09-30 조회 2,955
15-09-30 조회 2,943
15-09-25 조회 3,578
15-09-25 조회 3,323
15-09-24 조회 2,885
15-09-24 조회 2,823
15-09-24 조회 3,293
15-09-23 조회 3,292
15-09-23 조회 2,751
15-09-23 조회 2,828
15-09-23 조회 2,834
15-09-23 조회 2,837
15-09-23 조회 3,035
15-09-23 조회 2,982
15-09-22 조회 5,034
15-09-21 조회 3,014
15-09-21 조회 2,770
15-09-21 조회 2,782
15-09-21 조회 2,841
15-09-18 조회 4,410
15-09-17 조회 4,009
15-09-16 조회 3,380
15-09-14 조회 3,662
15-09-14 조회 3,814
15-09-13 조회 3,850
15-09-11 조회 3,041
15-09-11 조회 2,734
15-09-09 조회 3,370
15-09-08 조회 2,818
15-09-05 조회 2,881
15-09-04 조회 2,905
15-09-02 조회 3,538
15-09-02 조회 3,294
15-09-02 조회 3,049
15-09-01 조회 3,368
15-08-31 조회 7,749
15-08-29 조회 2,988
15-08-29 조회 4,235
15-08-28 조회 3,340
15-08-28 조회 4,252
15-08-25 조회 3,836
15-08-24 조회 2,900