2011-11-15 1 views
1

나는 jCarousel 플러그인을 사용하고 있는데 나는 도로 범프에 충돌 한에 jCarousel을 스크롤합니다. 기본 구성 변수를 "mouseover"로 변경하면 호버 당 한 번 스크롤됩니다.는 지속적으로 <p></p> 내가 탐색 버튼을 맴돌고 때마다 계속 스크롤 회전 목마 필요 ... 버튼 호버

나는 this similar question에 왔지만 나는 자바 스크립트 전문가가 아니기 때문에 답변을 얻을 수 없습니다. 어떤 도움이 많이 주시면 감사하겠습니다

function mycarousel_initCallback(carousel) 
{ 

    // Pause autoscrolling if the user moves with the cursor over the clip. 
    carousel.clip.hover(function() { 
     carousel.stopAuto(); 
    }, function() { 
     carousel.startAuto(); 
    }); 
}; 

jQuery(document).ready(function() { 
    jQuery('#mycarousel').jcarousel({ 
     auto: 10, 
     start: 1, 
     scroll: 1, 
     animation: 'slow', 
     wrap: 'circular', 
     buttonNextEvent: 'mouseover', 
     buttonPrevEvent: 'mouseover', 
     initCallback: mycarousel_initCallback 
    }); 
}); 

:

여기 내 코드입니다.

답변

4

다음 스크립트를 사용하여 작동하게 할 수 있습니다. 나는 그것을 테스트했습니다 jquery.jcarousel.jsjquery-1.4.1

참고로, jcarousel 설정에는 자동 스크롤이 없었습니다.

<script> 
jQuery(document).ready(function() { 
    var _this = null; 
    $('.jcarousel-next').mouseover(function() { 
     if (!$(this).hasClass("jcarousel-next-disabled")) { 
      _this = $(this); 
      _this.click(); 
      window.setTimeout(CallAgain, 100); 
     } 
    }); 

    $('.jcarousel-next').mouseout(function() { 
     if (!$(this).hasClass("jcarousel-next-disabled")) { 
      _this = null; 
     } 
    }); 

    function CallAgain() { 
     if (_this != null) { 
      //alert("Inside Call again"); 
      _this.click(); 
      window.setTimeout(CallAgain, 100); 
     } 
    }; 

    $('.jcarousel-prev').mouseover(function() { 
     if (!jQuery(this).hasClass("jcarousel-prev-disabled")){ 
      _this = $(this); 
      _this.click(); 
      window.setTimeout(CallAgain, 100); 
     } 
    }); 

    $('.jcarousel-prev').mouseout(function() { 
     if (!$(this).hasClass("jcarousel-next-disabled")) { 
      _this = null; 
     } 
    }); 
}); 
</script> 
+0

어디에이 스크립트를 넣을 까? 캐 러셀이 표시되는 .html 파일에 넣으시겠습니까? 또한 'buttonNextEvent'와 'buttonPrevEvent'를 'mouseover'대신 'click'으로 설정해야합니까? –