-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathjquery.swapgallerywithdots.min.js
6 lines (6 loc) · 2.8 KB
/
jquery.swapgallerywithdots.min.js
1
2
3
4
5
6
/*! jQuery.swapgallerywithdots (https://github.com/Takazudo/jQuery.swapgallerywithdots)
* lastupdate: 2013-09-05
* version: 0.1.6
* author: 'Takazudo' Takeshi Takatsudo <[email protected]>
* License: MIT */
(function(){var t={}.hasOwnProperty,e=function(e,i){function r(){this.constructor=e}for(var n in i)t.call(i,n)&&(e[n]=i[n]);return r.prototype=i.prototype,e.prototype=new r,e.__super__=i.prototype,e};(function(t){var i;return i={},i.Main=function(r){function n(e,r){this.$el=e,this.options=t.extend({},i.Main.defaults,r),this.$gallery=this.$el.find(this.options.selector_gallery_container),this._countItems(),this._putDotsHtml(),this._prepareTouchdragh(),this._prepareDots(),this._eventify()}return e(n,r),n.defaults={selector_gallery_container:null,selector_gallery_inner:null,selector_gallery_inner2:null,selector_gallery_item:null,selector_dot_container:null,selector_dot_item:null,class_dot_activeItem:null,class_dot_inactiveItem:null,src_dotItem:null,stepwidth:null,widthbetween:0,forever:!1,forever_duplicate_count:1,maxindex:"auto",normalize_height:!0,normalize_height_on_resize:!0},n.prototype._countItems=function(){var t;return t=this.options.selector_gallery_item,this._itemsCount=this.$gallery.find(t).length,this},n.prototype._prepareTouchdragh=function(){var t,e,i;return i=this.options,t=this.$gallery.find(i.selector_gallery_item),e={inner:i.selector_gallery_inner,inner2:i.selector_gallery_inner2,item:i.selector_gallery_item,stepwidth:i.stepwidth||t.eq(0).outerWidth(),widthbetween:i.widthbetween||0,maxindex:i.maxindex,forever:i.forever,forever_duplicate_count:i.forever_duplicate_count,inner2left:i.inner2left||0,normalize_height:i.normalize_height,normalize_height_on_resize:i.normalize_height_on_resize},this.$gallery.touchdraghsteppy(e),this.touchdragh=this.$gallery.data("touchdraghsteppy"),this},n.prototype._putDotsHtml=function(){var t,e,i,r;for(this.$dots=this.$el.find(this.options.selector_dot_container),t=this.options.src_dotItem,e="",i=0,r=this._itemsCount;r>=0?r>i:i>r;r>=0?i++:i--)e+=t;return this.$dots.append(e),this},n.prototype._prepareDots=function(){var t,e;return e=this.options,t={selector_item:e.selector_dot_item,class_activeItem:e.class_dot_activeItem},e.class_dot_inactiveItem&&(t.class_inactiveItem=e.class_dot_inactiveItem),this.$dots.currentDots(t),this.dot=this.$dots.data("currentDots"),this},n.prototype._eventify=function(){var t=this;return this.dot.on("itemclick",function(e){return t.touchdragh.to(e.index,!0)}),this.touchdragh.on("indexchange",function(e){var i;return i=t.options.forever?e.normalizedIndex:e.index,t.dot.to(i),t.trigger("indexchange",{index:i})}),this},n}(window.EveEve),t.fn.swapgallerywithdots=function(e){return this.each(function(r,n){var o,s;o=t(n),s=new i.Main(o,e),o.data("swapgallerywithdots",s)})},t.SwapgallerywithdotsNs=i,t.Swapgallerywithdots=i.Main})(jQuery)}).call(this);