...
|
...
|
@@ -7,6 +7,37 @@ var $ = require('jquery'); |
|
|
|
|
|
(function($) {
|
|
|
$.fn.slider2 = function(options) {
|
|
|
function autoplay(index, limit, toright) {
|
|
|
if (toright === true) {
|
|
|
$('.next').trigger('click');
|
|
|
if (index === (limit - 3)) {
|
|
|
autoplayrecycle(--index, limit, false);
|
|
|
} else {
|
|
|
autoplayrecycle(++index, limit, true);
|
|
|
}
|
|
|
} else {
|
|
|
$('.prev').trigger('click');
|
|
|
if (index === 0) {
|
|
|
autoplayrecycle(++index, limit, true);
|
|
|
} else {
|
|
|
autoplayrecycle(--index, limit, false);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function autoplayrecycle(index, limit, toright) {
|
|
|
window.setTimeout(autoplay, $.fn.slider2.defaults.delaytime, index, limit, toright);
|
|
|
}
|
|
|
|
|
|
function changePic(index, width, callback) {
|
|
|
var offersetleft = -(index * width);
|
|
|
|
|
|
$('.img-list')
|
|
|
.animate({
|
|
|
'margin-left': offersetleft + 'px'
|
|
|
}, 'slow', callback);
|
|
|
|
|
|
}
|
|
|
$.fn.slider2.defaults = {
|
|
|
index: 0,
|
|
|
shownum: 3,
|
...
|
...
|
@@ -79,37 +110,6 @@ var $ = require('jquery'); |
|
|
}
|
|
|
});
|
|
|
|
|
|
function autoplay(index, limit, toright) {
|
|
|
if (toright === true) {
|
|
|
$('.next').trigger('click');
|
|
|
if (index === (limit - 3)) {
|
|
|
autoplayrecycle(--index, limit, false);
|
|
|
} else {
|
|
|
autoplayrecycle(++index, limit, true);
|
|
|
}
|
|
|
} else {
|
|
|
$('.prev').trigger('click');
|
|
|
if (index === 0) {
|
|
|
autoplayrecycle(++index, limit, true);
|
|
|
} else {
|
|
|
autoplayrecycle(--index, limit, false);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function autoplayrecycle(index, limit, toright) {
|
|
|
window.setTimeout(autoplay, $.fn.slider2.defaults.delaytime, index, limit, toright);
|
|
|
}
|
|
|
|
|
|
function changePic(index, width, callback) {
|
|
|
var offersetleft = -(index * width);
|
|
|
|
|
|
$('.img-list')
|
|
|
.animate({
|
|
|
'margin-left': offersetleft + 'px'
|
|
|
}, 'slow', callback);
|
|
|
|
|
|
}
|
|
|
};
|
|
|
|
|
|
}($)); |
|
|
\ No newline at end of file |
...
|
...
|
|