Nấm*_*Lùn 2 jquery function click jcarousel next
我使用jCarousel创建滚动内容(请点击此http://sorgalla.com/projects/jcarousel/).但是我不想使用默认的下一个和上一个按钮,所以我想创建2个按钮来处理click事件.EX:我有2个像这样的超链接:
<script>
jQuery(document).ready(function() {
// Initialise the first and second carousel by class selector.
// Note that they use both the same configuration options (none in this case).
jQuery('#scrollArea').jcarousel({
scroll: 10
});
</script>
<a>NEXT</a>
<a>PREV</a>
<div id="scrollArea">
<!-- CONTENT HERE -->
</div>
Run Code Online (Sandbox Code Playgroud)
如何将next和prev函数绑定到上面的链接?
看看这个例子:
http://sorgalla.com/projects/jcarousel/examples/static_controls.html
基本上,您可以在轮播初始化中将功能附加到轮播.这是相关的片段.
function mycarousel_initCallback(carousel) {
jQuery('#mycarousel-next').bind('click', function() {
carousel.next();
return false;
});
jQuery('#mycarousel-prev').bind('click', function() {
carousel.prev();
return false;
});
};
Run Code Online (Sandbox Code Playgroud)