PageSourceSearch

https://www.prodital.it/js/vendor/owl.animate.js

js prodital.it collected 2026-10-04 22:25:06 UTC 2,983 bytes, 120 lines download raw bytes

vendor: 2,983 bytes, lines 1-120
1/**
2 * Animate Plugin
3 * @version 2.0.0
4 * @author Bartosz Wojciechowski
5 * @license The MIT License (MIT)
6 */
7;(function($, window, document, undefined) {
8
9	/**
10	 * Creates the animate plugin.
11	 * @class The Navigation Plugin
12	 * @param {Owl} scope - The Owl Carousel
13	 */
14	var Animate = function(scope) {
15		this.core = scope;
16		this.core.options = $.extend({}, Animate.Defaults, this.core.options);
17		this.swapping = true;
18		this.previous = undefined;
19		this.next = undefined;
20
21		this.handlers = {
22			'change.owl.carousel': $.proxy(function(e) {
23				if (e.namespace && e.property.name == 'position') {
24					this.previous = this.core.current();
25					this.next = e.property.value;
26				}
27			}, this),
28			'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
29				if (e.namespace) {
30					this.swapping = e.type == 'translated';
31				}
32			}, this),
33			'translate.owl.carousel': $.proxy(function(e) {
34				if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
35					this.swap();
36				}
37			}, this)
38		};
39
40		this.core.$element.on(this.handlers);
41	};
42
43	/**
44	 * Default options.
45	 * @public
46	 */
47	Animate.Defaults = {
48		animateOut: false,
49		animateIn: false
50	};
51
52	/**
53	 * Toggles the animation classes whenever an translations starts.
54	 * @protected
55	 * @returns {Boolean|undefined}
56	 */
57	Animate.prototype.swap = function() {
58
59		if (this.core.settings.items !== 1) {
60			return;
61		}
62
63		if (!$.support.animation || !$.support.transition) {
64			return;
65		}
66
67		this.core.speed(0);
68
69		var left,
70			clear = $.proxy(this.clear, this),
71			previous = this.core.$stage.children().eq(this.previous),
72			next = this.core.$stage.children().eq(this.next),
73			incoming = this.core.settings.animateIn,
74			outgoing = this.core.settings.animateOut;
75
76		if (this.core.current() === this.previous) {
77			return;
78		}
79
80		if (outgoing) {
81			left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
82			previous.one($.support.animation.end, clear)
83				.css( { 'left': left + 'px' } )
84				.addClass('animated owl-animated-out')
85				.addClass(outgoing);
86		}
87
88		if (incoming) {
89			next.one($.support.animation.end, clear)
90				.addClass('animated owl-animated-in')
91				.addClass(incoming);
92		}
93	};
94
95	Animate.prototype.clear = function(e) {
96		$(e.target).css( { 'left': '' } )
97			.removeClass('animated owl-animated-out owl-animated-in')
98			.removeClass(this.core.settings.animateIn)
99			.removeClass(this.core.settings.animateOut);
100		this.core.onTransitionEnd();
101	};
102
103	/**
104	 * Destroys the plugin.
105	 * @public
106	 */
107	Animate.prototype.destroy = function() {
108		var handler, property;
109
110		for (handler in this.handlers) {
111			this.core.$element.off(handler, this.handlers[handler]);
112		}
113		for (property in Object.getOwnPropertyNames(this)) {
114			typeof this[property] != 'function' && (this[property] = null);
115		}
116	};
117
118	$.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
119
120})(window.Zepto || window.jQuery, window, document);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.