/*! * crosscover v1.0.2 * Carousel of a simple background image using jquery and animate.css. * http://git.blivesta.com/crosscover * License : MIT * Author : blivesta (http://blivesta.com/) */ ;(function(factory) { 'use strict'; if (typeof define === 'function' && define.amd) { define(['jquery'], factory); } else if (typeof exports === 'object') { module.exports = factory(require('jquery')); } else { factory(jQuery); } }(function($) { 'use strict'; var namespace = 'crosscover'; var __ = { init: function(options) { options = $.extend({ inClass: 'fade-in', outClass: 'fade-out', interval: 6000, startIndex: 0, autoPlay: true, dotsNav: true, controller: false, controllerClass: 'crosscover-controller', prevClass: 'crosscover-prev', nextClass: 'crosscover-next', playerClass: 'crosscover-player', playerInnerHtml: '', prevInnerHtml: '', nextInnerHtml: '' }, options); __.settings = { currentIndex: options.startIndex, timer: null, coverBaseClass:'crosscover-item', coverWaitClass:'is-wait', coverActiveClass:'is-active', playerActiveClass: 'is-playing', dotsNavClass: 'crosscover-dots' }; return this.each(function() { var _this = this; var $this = $(this); var data = $this.data(namespace); var $item = $this.children('.crosscover-list').children('.' + __.settings.coverBaseClass); if (!data) { options = $.extend({}, options); $this.data(namespace, { options: options }); if (options.dotsNav) __.createDots.call(_this, $item); if (options.controller) __.createControler.call(_this, $item); __.setup.call(_this, $item); } }); }, setup: function($item) { var _this = this; var $this = $(this); var options = $this.data(namespace).options; $item.each(function(index) { var $self = $(this); var image = $self.find('img').attr('src'); $self .addClass(__.settings.coverBaseClass, __.settings.coverWaitClass) .css({ 'background-image': 'url(' + image + ')' }); }); return __.slideStart.call(_this, $item); }, slideStart: function($item) { var _this = this; __.autoPlayStart.call(_this, $item); __.show.call(_this, $item); }, createDots: function($item) { var _this = this; var $this = $(this); var options = $this.data(namespace).options; var len = $item.length; $this .append( $('