diff --git a/js/jquery.cslider.js b/js/jquery.cslider.js index ab7e5065..f52b32c4 100644 --- a/js/jquery.cslider.js +++ b/js/jquery.cslider.js @@ -1,59 +1,58 @@ // Original: https://github.com/Le-Stagiaire/jquery.cslider/blob/0c99322/src/jquery.cslider.js +'use strict'; (function ($) { - // Slider object $.Slider = function (options, element) { this.$el = $(element); this._init(options); }; $.Slider.defaults = { - current: 0, // index of current slide - bgincrement: 100, // increment the bg position (parallax effect) when sliding - autoplay: true, // slideshow on / off - interval: 6000 // time between transitions + current: 0, // Initial slide [index] + bgincrement: 100, // Background parallax [pixels], set "0" to disable + autoplay: true, // Slideshow enabled [true|false] + interval: 6000 // Slideshow interval [milliseconds] }; $.Slider.prototype = { _init: function (options) { this.options = $.extend(true, {}, $.Slider.defaults, options); + this.isAnimating = false; + this.bgpositer = 0; + // Detect slides this.$slides = this.$el.find('div.da-slide'); this.slidesCount = this.$slides.length; - this.current = this.options.current; - if (this.current < 0 || this.current >= this.slidesCount) { - this.current = 0; - } + this.current = (this.options.current >= 0 && this.options.current < this.slidesCount) ? this.options.current : 0; this.$slides.eq(this.current).addClass('da-slide-current'); + // Create navigation dots var $navigation = $('