버

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

· 2014-03-25 (화) 13:16:51 · 3762 · 1

;(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건
+
제목 글쓴이 날짜 조회
16-06-11 조회 2,847
16-02-15 조회 3,167
16-02-02 조회 2,830
16-01-25 조회 2,438
16-01-18 조회 2,534
16-01-08 조회 2,476
16-01-07 조회 2,501
16-01-05 조회 2,508
16-01-05 조회 2,805
16-01-05 조회 2,650
16-01-05 조회 2,695
16-01-04 조회 2,484
16-01-04 조회 2,584
16-01-04 조회 2,532
16-01-04 조회 2,449
15-12-30 조회 2,744
15-12-24 조회 2,569
15-12-24 조회 2,597
15-12-24 조회 2,626
15-12-24 조회 2,586
15-12-23 조회 2,559
15-12-16 조회 2,650
15-12-15 조회 2,732
15-12-11 조회 2,787
15-12-10 조회 2,713
15-11-09 조회 2,697
15-11-09 조회 2,875
15-10-06 조회 3,205
15-10-02 조회 3,046
15-05-29 조회 4,383
15-02-02 조회 4,165
15-01-18 조회 4,109
14-10-25 조회 8,209
14-10-25 조회 5,012
14-10-22 조회 7,021
14-10-22 조회 4,760
14-10-22 조회 4,694
14-10-18 조회 5,451
14-10-17 조회 5,822
14-10-17 조회 5,272
14-10-17 조회 8,699
14-10-17 조회 6,258
14-10-13 조회 4,074
14-10-13 조회 4,323
14-10-07 조회 6,032
14-09-24 조회 3,822
14-09-23 조회 3,895
14-09-22 조회 4,700
14-09-22 조회 5,947
14-09-22 조회 3,950
14-09-22 조회 3,584
14-09-21 조회 4,119
14-09-21 조회 3,662
14-09-20 조회 3,675
14-09-20 조회 3,584
14-09-20 조회 3,774
14-09-19 조회 3,665
14-09-19 조회 3,824
14-09-19 조회 3,706
14-09-19 조회 3,979
14-09-19 조회 3,757
14-09-19 조회 3,685
14-09-19 조회 3,914
14-09-19 조회 3,667
14-09-19 조회 3,653
14-09-19 조회 3,713
14-09-18 조회 3,697
14-09-18 조회 3,716
14-09-18 조회 3,880
14-09-18 조회 3,904
14-09-18 조회 3,934
14-09-18 조회 4,696
14-09-18 조회 5,272
14-09-18 조회 5,208
14-09-18 조회 4,006
14-09-18 조회 4,490
14-09-18 조회 4,144
14-08-30 조회 5,241
14-08-06 조회 5,892
14-08-06 조회 5,468
14-08-03 조회 4,982
14-06-12 조회 5,269
14-05-11 조회 3,583
14-05-11 조회 4,374
14-05-11 조회 4,474
14-05-09 조회 1.2만
14-05-01 조회 4,846
14-03-30 조회 4,309
14-03-23 조회 7,856
14-02-12 조회 3,786
13-10-29 조회 7,654
13-10-28 조회 8,583
13-09-29 조회 6,542
13-09-29 조회 4,174
13-07-23 조회 4,886
13-07-23 조회 1.2만
13-07-14 조회 4,622
13-07-14 조회 4,968
13-07-14 조회 5,934
13-07-14 조회 5,110