-
Notifications
You must be signed in to change notification settings - Fork 736
/
Copy pathjquery.jcarousel-control.min.js
5 lines (4 loc) · 1.38 KB
/
jquery.jcarousel-control.min.js
1
2
3
4
5
/*! jCarousel - v0.3.9 - 2018-07-30
* http://sorgalla.com/jcarousel/
* Copyright (c) 2006-2018 Jan Sorgalla; Licensed MIT */
!function(t){"use strict";t.jCarousel.plugin("jcarouselControl",{_options:{target:"+=1",event:"click",method:"scroll"},_active:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onReload=t.proxy(this._reload,this),this.onEvent=t.proxy(function(e){e.preventDefault();var o=this.options("method");t.isFunction(o)?o.call(this):this.carousel().jcarousel(this.options("method"),this.options("target"))},this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy).on("jcarousel:reloadend jcarousel:scrollend",this.onReload),this._element.on(this.options("event")+".jcarouselcontrol",this.onEvent),this._reload()},_destroy:function(){this._element.off(".jcarouselcontrol",this.onEvent),this.carousel().off("jcarousel:destroy",this.onDestroy).off("jcarousel:reloadend jcarousel:scrollend",this.onReload)},_reload:function(){var e,o=t.jCarousel.parseTarget(this.options("target")),s=this.carousel();if(o.relative)e=s.jcarousel(o.target>0?"hasNext":"hasPrev");else{var r="object"!=typeof o.target?s.jcarousel("items").eq(o.target):o.target;e=s.jcarousel("target").index(r)>=0}return this._active!==e&&(this._trigger(e?"active":"inactive"),this._active=e),this}})}(jQuery);