var itemLenght = 0,
currItemIndex = 0,
started = false,
oInterval = {},
setting = {
intervalTime: 3000,
step: 1,
imagePanels: $(),
animateConfig: {
atype: 'fade',
fadeInSpeed: 500,
fadeOutSpeed: 1000
},
panelHoverStop: true,
ctrlItems: $(),
ctrlItemActivateType: 'hover' || 'click',
ctrlItemHoverCls: '',
flipBtn: {},
panelHoverShowFlipBtn: true,
callbacks: {
animate: null
}
},
that = this
;
//core methods
var slider = {
pre: function() {
var toIndex = itemLenght +
(currItemIndex - setting.step) % itemLenght;
slider.to(toIndex);
},
next: function() {
var toIndex = (currItemIndex + setting.step) % itemLenght;
slider.to(toIndex);
},
to: function(toIndex) {
//handle the index value
if(typeof toIndex === 'function') {
toIndex = toIndex.call(that, concatArray(setting.imagePanels, true),
concatArray(setting.ctrlItems, true),
currItemIndex, step);
}
if(window.isNaN(toIndex)) {
toIndex = 0;
}
toIndex = Math.round(+toIndex) % itemLenght;
if(toIndex < 0) {
toIndex = itemLenght + toIndex;
}
var currentPanel = setting.imagePanels.eq(currItemIndex),
toPanel = setting.imagePanels.eq(toIndex),
currrntCtrlItem = setting.ctrlItems.eq(currItemIndex)
toCtrlItem = setting.ctrlItems.eq(toIndex)
;
if(!setting.callbacks.animate ||
setting.callbacks.animate.call(that,
concatArray(setting.imagePanels, true),
concatArray(setting.ctrlItems, true),
currItemIndex, toIndex) === true) {
currrntCtrlItem.removeClass(setting.ctrlItemHoverCls);
toCtrlItem.addClass(setting.ctrlItemHoverCls);
toPanel.fadeIn(setting.animateConfig.fadeInSpeed);
currentPanel.fadeOut(setting.animateConfig.fadeOutSpeed);
}
//set the current item index
currItemIndex = toIndex;
},
start: function() {
if(!started) {
started = true;
oInterval =
window.setInterval(slider.next, setting.intervalTime);
}
},
stop: function() {










