elements: {
"p": {delay: 100, speed: 1000, easing: "easeInOutBack"}
},
navigation: true, // the dots navigation on the bottom
navigationClass: "slider-nav",
// callbacks
// another way to "catch" these events is with
// $(-slider-element-).bind("animationStart")
animationStart: null,
animationEnd: null
},
init: function() {
var c, e, element, $element,
that = this,
$firstFrame;
c = this.config = $.extend({}, this.defaults, this.options);
this.elem.style.position = "relative"; // make the wrapping element relative
// basics
this.$frames = this.$elem.find(c.framesSelector);
this.framesCount = this.$frames.length;
this.currentFrame = 0;
this.queue = [];
this._$elementsByFrame = {};
this._$disposeElementsByFrame = {};
for (i = 0; i < this.framesCount; i++) {
this._$elementsByFrame[i] = this._getFrameElements(i); // cache the $elements by frame
this._$disposeElementsByFrame[i] = this._getDisposeFrameElements(i); // cache the rest of the tree for each frame
}
if (c.navigation) {
generateNavigation(this.$elem, this.framesCount, c);
this.$navigation = this.$elem.find("."+c.navigationClass);
}
// bindings
this.$elem.find(".slider-nav").delegate("a", "click", function(e){
var frame = this.getAttribute("href").split("#")[1];
that.go.call(that, frame);
return false;
});
this.$elem // internal bindings for the callbacks
.bind("animationStart", function(){
if ($.isFunction(c.animationStart)) {c.animationStart.apply(that, arguments);}
})
.bind("animationEnd", function(){
if ($.isFunction(c.animationEnd)) {c.animationEnd.apply(that, arguments);}
})
;
// start animation?
if (c.autoStart) {
this.start();
} else {
this.running = false;
}
return this;
},
start: function(instant) {
var that = this;
if (this.timer) { // we'll clear the current timer
window.clearTimeout(this.timer);
}
this.running = true;
if (instant) {
that.nextFrame();
} else {
this.timer = window.setTimeout(function(){ that.nextFrame.call(that) }, that.config.delayAnimation);
}
},
stop: function() {
if (!this.running) return; // we are not running
this.running = false;
window.clearTimeout(this.timer);
},
// main function for changing frames
selectFrame: function(frame, dfr) {
var c = this.config, // shorthand for the config
that = this,
dfr = dfr || $.Deferred(),
dFadeIn = $.Deferred(),
dFadeOut = $.Deferred();
if (isNaN(frame) || frame < 0 || frame > this.framesCount || frame === this.currentFrame) {
dfr.reject();
return dfr.promise();
}
// clear the animation loop interval if the animation is running









