javascript Jquery微小滑块 - 通过事件绑定
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Jquery微小滑块 - 通过事件绑定相关的知识,希望对你有一定的参考价值。
(function($) {
$.fn.slideshow = function(options) {
return this.each(function() {
var $img = $(this),
current = 0;
function show(index) {
var total = options.images.length;
while(index < 0)
{
index += total;
}
while(index >= total)
{
index -= total;
}
current = index;
$img.attr('src', options.images[index]);
}
function prev() {
show(current - 1);
}
function next() {
show(current + 1);
}
$img.bind('prev', prev)
.bind('next', next)
.bind('goto',function(e, index) {
show( index );
});
});
};
})(jQuery);
var $image = $('#slideshow');
$image.slideshow({
images: ['1.png', '2.png', '3.png'],
interval: 3000
});
$('#prev').click(function() {
$image.trigger('prev');
});
$('#next').click(function() {
$image.trigger('next');
});
$image.trigger('goto', 0);
以上是关于javascript Jquery微小滑块 - 通过事件绑定的主要内容,如果未能解决你的问题,请参考以下文章
javascript 微小的滑块
html 微小滑块的多个实例
html 微小滑块的多个实例
jquery的微小实现
javascript jQuery的UI滑块
一个微小的&;用于可排序表的死的简单jQuery插件。