owlcarousel2 2.2.0.pre.4.pre.g22132e0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.gitmodules +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/Rakefile +13 -0
- data/lib/owlcarousel2.rb +9 -0
- data/lib/owlcarousel2/engine.rb +5 -0
- data/lib/owlcarousel2/version.rb +3 -0
- data/owlcarousel2.gemspec +25 -0
- data/vendor/assets/images/owlcarousel2/ajax-loader.gif +0 -0
- data/vendor/assets/images/owlcarousel2/owl.video.play.png +0 -0
- data/vendor/assets/javascripts/owlcarousel2/owl.animate.js +121 -0
- data/vendor/assets/javascripts/owlcarousel2/owl.autoheight.js +97 -0
- data/vendor/assets/javascripts/owlcarousel2/owl.autoplay.js +199 -0
- data/vendor/assets/javascripts/owlcarousel2/owl.autorefresh.js +111 -0
- data/vendor/assets/javascripts/owlcarousel2/owl.carousel.js +1692 -0
- data/vendor/assets/javascripts/owlcarousel2/owl.hash.js +122 -0
- data/vendor/assets/javascripts/owlcarousel2/owl.lazyload.js +135 -0
- data/vendor/assets/javascripts/owlcarousel2/owl.navigation.js +382 -0
- data/vendor/assets/javascripts/owlcarousel2/owl.support.js +83 -0
- data/vendor/assets/javascripts/owlcarousel2/owl.support.modernizr.js +66 -0
- data/vendor/assets/javascripts/owlcarousel2/owl.video.js +319 -0
- data/vendor/assets/stylesheets/owlcarousel2/_animate.scss +28 -0
- data/vendor/assets/stylesheets/owlcarousel2/_autoheight.scss +7 -0
- data/vendor/assets/stylesheets/owlcarousel2/_core.scss +114 -0
- data/vendor/assets/stylesheets/owlcarousel2/_lazyload.scss +17 -0
- data/vendor/assets/stylesheets/owlcarousel2/_theme.default.scss +30 -0
- data/vendor/assets/stylesheets/owlcarousel2/_theme.green.scss +30 -0
- data/vendor/assets/stylesheets/owlcarousel2/_theme.scss +64 -0
- data/vendor/assets/stylesheets/owlcarousel2/_video.scss +51 -0
- data/vendor/assets/stylesheets/owlcarousel2/owl.carousel.scss +5 -0
- data/vendor/assets/stylesheets/owlcarousel2/owl.theme.default.scss +1 -0
- data/vendor/assets/stylesheets/owlcarousel2/owl.theme.green.scss +1 -0
- metadata +93 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: be7e12fc84e27decaee4821ffaf59c0fdfd4aee9
|
4
|
+
data.tar.gz: 295dec9c798bea0a49099368c44a7f3ff2129648
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ae341de205ade9efa15dbca1b728c5bc9e03019809601d38c4a53df8e69d0c5e4b7f1feb0624aff6f2f4cc11a605307d3df7fe2cf4b955ae5d537d1e1eec6e55
|
7
|
+
data.tar.gz: 5404243a1c1b1849da69e8ebe842771c1b5cd4b0e122e8ef3d74c7188264be2d6609dedb20768597fe3428e8510ca446a706041d7fafe4f3aadb7ff16b8f15c1
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Sjors Sparreboom
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# OwlCarousel-2-Rails
|
2
|
+
|
3
|
+
This gem bundles [OwlCarousel2](https://github.com/OwlCarousel2/OwlCarousel2)
|
4
|
+
for the Rails asset pipeline.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'owlcarousel2'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install owlcarousel2
|
21
|
+
|
22
|
+
## Configuration
|
23
|
+
|
24
|
+
Add this line to your application.js
|
25
|
+
|
26
|
+
```javascript
|
27
|
+
//= require owlcarousel2/owl.carousel
|
28
|
+
```
|
29
|
+
|
30
|
+
Add these lines to app/assets/stylesheets/application.css
|
31
|
+
|
32
|
+
```css
|
33
|
+
@import 'owlcarousel2/owl.carousel';
|
34
|
+
```
|
35
|
+
_Optional_:
|
36
|
+
```css
|
37
|
+
@import 'owlcarousel2/owl.theme.default';
|
38
|
+
```
|
39
|
+
OR
|
40
|
+
```css
|
41
|
+
@import 'owlcarousel2/owl.theme.green';
|
42
|
+
```
|
43
|
+
## Usage
|
44
|
+
Check out the official
|
45
|
+
[repo](https://github.com/OwlCarousel2/OwlCarousel2#usage) or search the official documentation [documentation](https://owlcarousel2.github.io/OwlCarousel2/)
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/git-jls/owlcarousel2-rails.
|
50
|
+
|
51
|
+
## License
|
52
|
+
|
53
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
|
5
|
+
desc 'Upgrade to the latest version of owlcarousel2'
|
6
|
+
task :upgrade do
|
7
|
+
system 'git submodule update'
|
8
|
+
system 'cp OwlCarousel2/src/scss/* vendor/assets/stylesheets/owlcarousel2/'
|
9
|
+
system 'cp OwlCarousel2/src/js/* vendor/assets/javascripts/owlcarousel2/'
|
10
|
+
system 'cp OwlCarousel2/src/img/* vendor/assets/images/owlcarousel2/'
|
11
|
+
end
|
12
|
+
|
13
|
+
|
data/lib/owlcarousel2.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'owlcarousel2/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "owlcarousel2"
|
8
|
+
spec.version = OwlCarousel2::VERSION
|
9
|
+
spec.authors = ["Sjors Sparreboom"]
|
10
|
+
spec.email = ["mail@sjorssparreboom.nl"]
|
11
|
+
|
12
|
+
spec.summary = %q{Touch enabled jQuery plugin that lets you create a beautiful responsive carousel slider.}
|
13
|
+
spec.description = ''
|
14
|
+
spec.homepage = "https://github.com/git-jls/owlcarousel2-rails"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency 'sass'
|
25
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1,121 @@
|
|
1
|
+
/**
|
2
|
+
* Animate Plugin
|
3
|
+
* @version 2.1.0
|
4
|
+
* @author Bartosz Wojciechowski
|
5
|
+
* @author David Deutsch
|
6
|
+
* @license The MIT License (MIT)
|
7
|
+
*/
|
8
|
+
;(function($, window, document, undefined) {
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Creates the animate plugin.
|
12
|
+
* @class The Navigation Plugin
|
13
|
+
* @param {Owl} scope - The Owl Carousel
|
14
|
+
*/
|
15
|
+
var Animate = function(scope) {
|
16
|
+
this.core = scope;
|
17
|
+
this.core.options = $.extend({}, Animate.Defaults, this.core.options);
|
18
|
+
this.swapping = true;
|
19
|
+
this.previous = undefined;
|
20
|
+
this.next = undefined;
|
21
|
+
|
22
|
+
this.handlers = {
|
23
|
+
'change.owl.carousel': $.proxy(function(e) {
|
24
|
+
if (e.namespace && e.property.name == 'position') {
|
25
|
+
this.previous = this.core.current();
|
26
|
+
this.next = e.property.value;
|
27
|
+
}
|
28
|
+
}, this),
|
29
|
+
'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
|
30
|
+
if (e.namespace) {
|
31
|
+
this.swapping = e.type == 'translated';
|
32
|
+
}
|
33
|
+
}, this),
|
34
|
+
'translate.owl.carousel': $.proxy(function(e) {
|
35
|
+
if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
|
36
|
+
this.swap();
|
37
|
+
}
|
38
|
+
}, this)
|
39
|
+
};
|
40
|
+
|
41
|
+
this.core.$element.on(this.handlers);
|
42
|
+
};
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Default options.
|
46
|
+
* @public
|
47
|
+
*/
|
48
|
+
Animate.Defaults = {
|
49
|
+
animateOut: false,
|
50
|
+
animateIn: false
|
51
|
+
};
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Toggles the animation classes whenever an translations starts.
|
55
|
+
* @protected
|
56
|
+
* @returns {Boolean|undefined}
|
57
|
+
*/
|
58
|
+
Animate.prototype.swap = function() {
|
59
|
+
|
60
|
+
if (this.core.settings.items !== 1) {
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
|
64
|
+
if (!$.support.animation || !$.support.transition) {
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
|
68
|
+
this.core.speed(0);
|
69
|
+
|
70
|
+
var left,
|
71
|
+
clear = $.proxy(this.clear, this),
|
72
|
+
previous = this.core.$stage.children().eq(this.previous),
|
73
|
+
next = this.core.$stage.children().eq(this.next),
|
74
|
+
incoming = this.core.settings.animateIn,
|
75
|
+
outgoing = this.core.settings.animateOut;
|
76
|
+
|
77
|
+
if (this.core.current() === this.previous) {
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
|
81
|
+
if (outgoing) {
|
82
|
+
left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
|
83
|
+
previous.one($.support.animation.end, clear)
|
84
|
+
.css( { 'left': left + 'px' } )
|
85
|
+
.addClass('animated owl-animated-out')
|
86
|
+
.addClass(outgoing);
|
87
|
+
}
|
88
|
+
|
89
|
+
if (incoming) {
|
90
|
+
next.one($.support.animation.end, clear)
|
91
|
+
.addClass('animated owl-animated-in')
|
92
|
+
.addClass(incoming);
|
93
|
+
}
|
94
|
+
};
|
95
|
+
|
96
|
+
Animate.prototype.clear = function(e) {
|
97
|
+
$(e.target).css( { 'left': '' } )
|
98
|
+
.removeClass('animated owl-animated-out owl-animated-in')
|
99
|
+
.removeClass(this.core.settings.animateIn)
|
100
|
+
.removeClass(this.core.settings.animateOut);
|
101
|
+
this.core.onTransitionEnd();
|
102
|
+
};
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Destroys the plugin.
|
106
|
+
* @public
|
107
|
+
*/
|
108
|
+
Animate.prototype.destroy = function() {
|
109
|
+
var handler, property;
|
110
|
+
|
111
|
+
for (handler in this.handlers) {
|
112
|
+
this.core.$element.off(handler, this.handlers[handler]);
|
113
|
+
}
|
114
|
+
for (property in Object.getOwnPropertyNames(this)) {
|
115
|
+
typeof this[property] != 'function' && (this[property] = null);
|
116
|
+
}
|
117
|
+
};
|
118
|
+
|
119
|
+
$.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
|
120
|
+
|
121
|
+
})(window.Zepto || window.jQuery, window, document);
|
@@ -0,0 +1,97 @@
|
|
1
|
+
/**
|
2
|
+
* AutoHeight Plugin
|
3
|
+
* @version 2.1.0
|
4
|
+
* @author Bartosz Wojciechowski
|
5
|
+
* @author David Deutsch
|
6
|
+
* @license The MIT License (MIT)
|
7
|
+
*/
|
8
|
+
;(function($, window, document, undefined) {
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Creates the auto height plugin.
|
12
|
+
* @class The Auto Height Plugin
|
13
|
+
* @param {Owl} carousel - The Owl Carousel
|
14
|
+
*/
|
15
|
+
var AutoHeight = function(carousel) {
|
16
|
+
/**
|
17
|
+
* Reference to the core.
|
18
|
+
* @protected
|
19
|
+
* @type {Owl}
|
20
|
+
*/
|
21
|
+
this._core = carousel;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* All event handlers.
|
25
|
+
* @protected
|
26
|
+
* @type {Object}
|
27
|
+
*/
|
28
|
+
this._handlers = {
|
29
|
+
'initialized.owl.carousel refreshed.owl.carousel': $.proxy(function(e) {
|
30
|
+
if (e.namespace && this._core.settings.autoHeight) {
|
31
|
+
this.update();
|
32
|
+
}
|
33
|
+
}, this),
|
34
|
+
'changed.owl.carousel': $.proxy(function(e) {
|
35
|
+
if (e.namespace && this._core.settings.autoHeight && e.property.name == 'position'){
|
36
|
+
this.update();
|
37
|
+
}
|
38
|
+
}, this),
|
39
|
+
'loaded.owl.lazy': $.proxy(function(e) {
|
40
|
+
if (e.namespace && this._core.settings.autoHeight
|
41
|
+
&& e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()) {
|
42
|
+
this.update();
|
43
|
+
}
|
44
|
+
}, this)
|
45
|
+
};
|
46
|
+
|
47
|
+
// set default options
|
48
|
+
this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);
|
49
|
+
|
50
|
+
// register event handlers
|
51
|
+
this._core.$element.on(this._handlers);
|
52
|
+
};
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Default options.
|
56
|
+
* @public
|
57
|
+
*/
|
58
|
+
AutoHeight.Defaults = {
|
59
|
+
autoHeight: false,
|
60
|
+
autoHeightClass: 'owl-height'
|
61
|
+
};
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Updates the view.
|
65
|
+
*/
|
66
|
+
AutoHeight.prototype.update = function() {
|
67
|
+
var start = this._core._current,
|
68
|
+
end = start + this._core.settings.items,
|
69
|
+
visible = this._core.$stage.children().toArray().slice(start, end),
|
70
|
+
heights = [],
|
71
|
+
maxheight = 0;
|
72
|
+
|
73
|
+
$.each(visible, function(index, item) {
|
74
|
+
heights.push($(item).height());
|
75
|
+
});
|
76
|
+
|
77
|
+
maxheight = Math.max.apply(null, heights);
|
78
|
+
|
79
|
+
this._core.$stage.parent()
|
80
|
+
.height(maxheight)
|
81
|
+
.addClass(this._core.settings.autoHeightClass);
|
82
|
+
};
|
83
|
+
|
84
|
+
AutoHeight.prototype.destroy = function() {
|
85
|
+
var handler, property;
|
86
|
+
|
87
|
+
for (handler in this._handlers) {
|
88
|
+
this._core.$element.off(handler, this._handlers[handler]);
|
89
|
+
}
|
90
|
+
for (property in Object.getOwnPropertyNames(this)) {
|
91
|
+
typeof this[property] != 'function' && (this[property] = null);
|
92
|
+
}
|
93
|
+
};
|
94
|
+
|
95
|
+
$.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
|
96
|
+
|
97
|
+
})(window.Zepto || window.jQuery, window, document);
|
@@ -0,0 +1,199 @@
|
|
1
|
+
/**
|
2
|
+
* Autoplay Plugin
|
3
|
+
* @version 2.1.0
|
4
|
+
* @author Bartosz Wojciechowski
|
5
|
+
* @author Artus Kolanowski
|
6
|
+
* @author David Deutsch
|
7
|
+
* @license The MIT License (MIT)
|
8
|
+
*/
|
9
|
+
;(function($, window, document, undefined) {
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Creates the autoplay plugin.
|
13
|
+
* @class The Autoplay Plugin
|
14
|
+
* @param {Owl} scope - The Owl Carousel
|
15
|
+
*/
|
16
|
+
var Autoplay = function(carousel) {
|
17
|
+
/**
|
18
|
+
* Reference to the core.
|
19
|
+
* @protected
|
20
|
+
* @type {Owl}
|
21
|
+
*/
|
22
|
+
this._core = carousel;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* The autoplay timeout.
|
26
|
+
* @type {Timeout}
|
27
|
+
*/
|
28
|
+
this._timeout = null;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Indicates whenever the autoplay is paused.
|
32
|
+
* @type {Boolean}
|
33
|
+
*/
|
34
|
+
this._paused = false;
|
35
|
+
|
36
|
+
/**
|
37
|
+
* All event handlers.
|
38
|
+
* @protected
|
39
|
+
* @type {Object}
|
40
|
+
*/
|
41
|
+
this._handlers = {
|
42
|
+
'changed.owl.carousel': $.proxy(function(e) {
|
43
|
+
if (e.namespace && e.property.name === 'settings') {
|
44
|
+
if (this._core.settings.autoplay) {
|
45
|
+
this.play();
|
46
|
+
} else {
|
47
|
+
this.stop();
|
48
|
+
}
|
49
|
+
} else if (e.namespace && e.property.name === 'position') {
|
50
|
+
//console.log('play?', e);
|
51
|
+
if (this._core.settings.autoplay) {
|
52
|
+
this._setAutoPlayInterval();
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}, this),
|
56
|
+
'initialized.owl.carousel': $.proxy(function(e) {
|
57
|
+
if (e.namespace && this._core.settings.autoplay) {
|
58
|
+
this.play();
|
59
|
+
}
|
60
|
+
}, this),
|
61
|
+
'play.owl.autoplay': $.proxy(function(e, t, s) {
|
62
|
+
if (e.namespace) {
|
63
|
+
this.play(t, s);
|
64
|
+
}
|
65
|
+
}, this),
|
66
|
+
'stop.owl.autoplay': $.proxy(function(e) {
|
67
|
+
if (e.namespace) {
|
68
|
+
this.stop();
|
69
|
+
}
|
70
|
+
}, this),
|
71
|
+
'mouseover.owl.autoplay': $.proxy(function() {
|
72
|
+
if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
|
73
|
+
this.pause();
|
74
|
+
}
|
75
|
+
}, this),
|
76
|
+
'mouseleave.owl.autoplay': $.proxy(function() {
|
77
|
+
if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
|
78
|
+
this.play();
|
79
|
+
}
|
80
|
+
}, this),
|
81
|
+
'touchstart.owl.core': $.proxy(function() {
|
82
|
+
if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
|
83
|
+
this.pause();
|
84
|
+
}
|
85
|
+
}, this),
|
86
|
+
'touchend.owl.core': $.proxy(function() {
|
87
|
+
if (this._core.settings.autoplayHoverPause) {
|
88
|
+
this.play();
|
89
|
+
}
|
90
|
+
}, this)
|
91
|
+
};
|
92
|
+
|
93
|
+
// register event handlers
|
94
|
+
this._core.$element.on(this._handlers);
|
95
|
+
|
96
|
+
// set default options
|
97
|
+
this._core.options = $.extend({}, Autoplay.Defaults, this._core.options);
|
98
|
+
};
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Default options.
|
102
|
+
* @public
|
103
|
+
*/
|
104
|
+
Autoplay.Defaults = {
|
105
|
+
autoplay: false,
|
106
|
+
autoplayTimeout: 5000,
|
107
|
+
autoplayHoverPause: false,
|
108
|
+
autoplaySpeed: false
|
109
|
+
};
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Starts the autoplay.
|
113
|
+
* @public
|
114
|
+
* @param {Number} [timeout] - The interval before the next animation starts.
|
115
|
+
* @param {Number} [speed] - The animation speed for the animations.
|
116
|
+
*/
|
117
|
+
Autoplay.prototype.play = function(timeout, speed) {
|
118
|
+
this._paused = false;
|
119
|
+
|
120
|
+
if (this._core.is('rotating')) {
|
121
|
+
return;
|
122
|
+
}
|
123
|
+
|
124
|
+
this._core.enter('rotating');
|
125
|
+
|
126
|
+
this._setAutoPlayInterval();
|
127
|
+
};
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Gets a new timeout
|
131
|
+
* @private
|
132
|
+
* @param {Number} [timeout] - The interval before the next animation starts.
|
133
|
+
* @param {Number} [speed] - The animation speed for the animations.
|
134
|
+
* @return {Timeout}
|
135
|
+
*/
|
136
|
+
Autoplay.prototype._getNextTimeout = function(timeout, speed) {
|
137
|
+
if ( this._timeout ) {
|
138
|
+
window.clearTimeout(this._timeout);
|
139
|
+
}
|
140
|
+
return window.setTimeout($.proxy(function() {
|
141
|
+
if (this._paused || this._core.is('busy') || this._core.is('interacting') || document.hidden) {
|
142
|
+
return;
|
143
|
+
}
|
144
|
+
this._core.next(speed || this._core.settings.autoplaySpeed);
|
145
|
+
}, this), timeout || this._core.settings.autoplayTimeout);
|
146
|
+
};
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Sets autoplay in motion.
|
150
|
+
* @private
|
151
|
+
*/
|
152
|
+
Autoplay.prototype._setAutoPlayInterval = function() {
|
153
|
+
this._timeout = this._getNextTimeout();
|
154
|
+
};
|
155
|
+
|
156
|
+
/**
|
157
|
+
* Stops the autoplay.
|
158
|
+
* @public
|
159
|
+
*/
|
160
|
+
Autoplay.prototype.stop = function() {
|
161
|
+
if (!this._core.is('rotating')) {
|
162
|
+
return;
|
163
|
+
}
|
164
|
+
|
165
|
+
window.clearTimeout(this._timeout);
|
166
|
+
this._core.leave('rotating');
|
167
|
+
};
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Stops the autoplay.
|
171
|
+
* @public
|
172
|
+
*/
|
173
|
+
Autoplay.prototype.pause = function() {
|
174
|
+
if (!this._core.is('rotating')) {
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
|
178
|
+
this._paused = true;
|
179
|
+
};
|
180
|
+
|
181
|
+
/**
|
182
|
+
* Destroys the plugin.
|
183
|
+
*/
|
184
|
+
Autoplay.prototype.destroy = function() {
|
185
|
+
var handler, property;
|
186
|
+
|
187
|
+
this.stop();
|
188
|
+
|
189
|
+
for (handler in this._handlers) {
|
190
|
+
this._core.$element.off(handler, this._handlers[handler]);
|
191
|
+
}
|
192
|
+
for (property in Object.getOwnPropertyNames(this)) {
|
193
|
+
typeof this[property] != 'function' && (this[property] = null);
|
194
|
+
}
|
195
|
+
};
|
196
|
+
|
197
|
+
$.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay;
|
198
|
+
|
199
|
+
})(window.Zepto || window.jQuery, window, document);
|