버

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


;(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건
+
제목 글쓴이 날짜 조회
13-10-29 조회 7,910
13-10-28 조회 8,740
13-10-28 조회 3,924
13-10-28 조회 3,463
13-10-27 조회 3,080
13-10-26 조회 3,796
13-10-25 조회 3,535
13-10-24 조회 3,497
13-10-24 조회 3,241
13-10-24 조회 3,558
13-10-24 조회 4,148
13-10-23 조회 4,313
13-10-23 조회 3,570
13-10-22 조회 4,805
13-10-21 조회 3,324
13-10-20 조회 3,654
13-10-18 조회 4,571
13-10-17 조회 4,942
13-10-15 조회 4,830
13-10-11 조회 4,691
13-10-10 조회 5,300
13-10-10 조회 3,765
13-10-08 조회 4,286
13-10-03 조회 6,362
13-10-02 조회 4,230
13-10-02 조회 4,509
13-10-02 조회 4,278
13-10-02 조회 3,760
13-10-02 조회 4,017
13-10-02 조회 3,870
13-10-02 조회 4,230
13-09-29 조회 4,784
13-09-29 조회 4,234
13-09-29 조회 4,109
13-09-29 조회 6,698
13-09-29 조회 4,328
13-09-27 조회 3,639
13-09-27 조회 4,273
13-09-24 조회 3,331
13-09-24 조회 3,608
13-09-18 조회 4,025
13-09-17 조회 3,885
13-09-16 조회 8,089
13-09-16 조회 5,454
13-09-16 조회 4,410
13-09-15 조회 3,258
13-09-13 조회 4,956
13-09-13 조회 3,436
13-09-13 조회 3,729
13-09-12 조회 3,531
13-09-11 조회 6,319
13-09-10 조회 3,591
13-09-10 조회 6,187
13-09-10 조회 3,952
13-09-09 조회 4,326
13-09-09 조회 4,978
13-09-07 조회 5,082
13-09-07 조회 3,166
13-09-06 조회 3,284
13-09-06 조회 3,907
13-09-06 조회 3,267
13-09-05 조회 3,445
13-09-05 조회 9,613
13-09-04 조회 3,140
13-09-04 조회 3,408
13-09-04 조회 3,087
13-09-03 조회 3,185
13-09-03 조회 3,598
13-08-30 조회 3,424
13-08-30 조회 4,517
13-08-29 조회 4,470
13-08-28 조회 3,979
13-08-28 조회 8,163
13-08-27 조회 4,148
13-08-26 조회 4,355
13-08-26 조회 3,583
13-08-26 조회 4,879
13-08-23 조회 4,169
13-08-23 조회 5,921
13-08-22 조회 5,450
13-08-22 조회 4,675
13-08-22 조회 5,178
13-08-22 조회 4,752
13-08-22 조회 4,670
13-08-22 조회 3,656
13-08-20 조회 3,912
13-08-18 조회 8,611
13-08-18 조회 5,511
13-08-17 조회 6,147
13-08-17 조회 4,964
13-08-17 조회 4,417
13-08-14 조회 3,448
13-08-12 조회 4,455
13-08-11 조회 3,628
13-08-09 조회 4,136
13-08-08 조회 5,371
13-08-08 조회 5,119
13-08-08 조회 4,509
13-08-08 조회 9,412
13-08-08 조회 5,609