materialize-sass 0.97.0 → 1.0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitattributes +1 -0
- data/.gitignore +3 -0
- data/README.md +48 -10
- data/Rakefile +129 -1
- data/assets/javascripts/materialize/anime.min.js +417 -0
- data/assets/javascripts/materialize/autocomplete.js +504 -0
- data/assets/javascripts/materialize/buttons.js +409 -0
- data/assets/javascripts/materialize/cards.js +34 -0
- data/assets/javascripts/materialize/carousel.js +797 -0
- data/assets/javascripts/materialize/cash.js +990 -0
- data/assets/javascripts/materialize/characterCounter.js +180 -0
- data/assets/javascripts/materialize/chips.js +564 -0
- data/assets/javascripts/materialize/collapsible.js +337 -0
- data/assets/javascripts/materialize/component.js +57 -0
- data/assets/javascripts/materialize/datepicker.js +935 -0
- data/assets/javascripts/materialize/dropdown.js +659 -0
- data/assets/javascripts/materialize/extras/nouislider.js +2147 -0
- data/assets/javascripts/materialize/extras/nouislider.min.js +1 -0
- data/assets/javascripts/materialize/forms.js +244 -0
- data/assets/javascripts/materialize/global.js +408 -0
- data/assets/javascripts/materialize/materialbox.js +513 -0
- data/assets/javascripts/materialize/modal.js +449 -0
- data/assets/javascripts/materialize/parallax.js +173 -0
- data/assets/javascripts/materialize/pushpin.js +179 -0
- data/assets/javascripts/materialize/range.js +310 -0
- data/assets/javascripts/materialize/scrollspy.js +328 -0
- data/assets/javascripts/materialize/select.js +497 -0
- data/assets/javascripts/materialize/sidenav.js +655 -0
- data/assets/javascripts/materialize/slider.js +424 -0
- data/assets/javascripts/materialize/tabs.js +476 -0
- data/assets/javascripts/materialize/tapTarget.js +364 -0
- data/assets/javascripts/materialize/timepicker.js +647 -0
- data/assets/javascripts/materialize/toasts.js +355 -0
- data/assets/javascripts/materialize/tooltip.js +351 -0
- data/{app/assets → assets}/javascripts/materialize/waves.js +42 -47
- data/assets/javascripts/materialize-sprockets.js +29 -0
- data/assets/javascripts/materialize.js +12374 -0
- data/assets/stylesheets/materialize/components/_badges.scss +55 -0
- data/assets/stylesheets/materialize/components/_buttons.scss +322 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_cards.scss +72 -29
- data/assets/stylesheets/materialize/components/_carousel.scss +90 -0
- data/assets/stylesheets/materialize/components/_chips.scss +90 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_collapsible.scss +23 -17
- data/assets/stylesheets/materialize/components/_color-classes.scss +32 -0
- data/{app/assets/stylesheets/materialize/components/_color.scss → assets/stylesheets/materialize/components/_color-variables.scss} +22 -64
- data/assets/stylesheets/materialize/components/_datepicker.scss +191 -0
- data/assets/stylesheets/materialize/components/_dropdown.scss +85 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_global.scss +197 -144
- data/{app/assets → assets}/stylesheets/materialize/components/_grid.scss +57 -18
- data/assets/stylesheets/materialize/components/_icons-material-design.scss +5 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_materialbox.scss +15 -13
- data/{app/assets → assets}/stylesheets/materialize/components/_modal.scss +18 -14
- data/{app/assets → assets}/stylesheets/materialize/components/_navbar.scss +89 -25
- data/assets/stylesheets/materialize/components/_normalize.scss +447 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_preloader.scss +5 -3
- data/assets/stylesheets/materialize/components/_pulse.scss +34 -0
- data/assets/stylesheets/materialize/components/_sidenav.scss +208 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_slider.scss +2 -2
- data/{app/assets → assets}/stylesheets/materialize/components/_table_of_contents.scss +5 -5
- data/assets/stylesheets/materialize/components/_tabs.scss +99 -0
- data/assets/stylesheets/materialize/components/_tapTarget.scss +103 -0
- data/assets/stylesheets/materialize/components/_timepicker.scss +183 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_toast.scss +17 -22
- data/assets/stylesheets/materialize/components/_tooltip.scss +32 -0
- data/assets/stylesheets/materialize/components/_transitions.scss +13 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_typography.scss +11 -9
- data/assets/stylesheets/materialize/components/_variables.scss +349 -0
- data/assets/stylesheets/materialize/components/_waves.scss +114 -0
- data/assets/stylesheets/materialize/components/forms/_checkboxes.scss +200 -0
- data/assets/stylesheets/materialize/components/forms/_file-input.scss +44 -0
- data/assets/stylesheets/materialize/components/forms/_forms.scss +22 -0
- data/assets/stylesheets/materialize/components/forms/_input-fields.scss +354 -0
- data/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +115 -0
- data/assets/stylesheets/materialize/components/forms/_range.scss +161 -0
- data/assets/stylesheets/materialize/components/forms/_select.scss +190 -0
- data/assets/stylesheets/materialize/components/forms/_switches.scss +89 -0
- data/assets/stylesheets/materialize/extras/nouislider.css +406 -0
- data/{app/assets → assets}/stylesheets/materialize.scss +13 -10
- data/lib/materialize-sass/engine.rb +11 -6
- data/lib/materialize-sass/helpers.rb +38 -0
- data/lib/materialize-sass/version.rb +1 -1
- data/lib/materialize-sass.rb +13 -28
- data/materialize-sass.gemspec +5 -5
- metadata +97 -105
- data/app/assets/fonts/material-design-icons/LICENSE.txt +0 -428
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.eot +0 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.svg +0 -769
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.ttf +0 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff +0 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
- data/app/assets/javascripts/materialize/animation.js +0 -9
- data/app/assets/javascripts/materialize/buttons.js +0 -61
- data/app/assets/javascripts/materialize/cards.js +0 -27
- data/app/assets/javascripts/materialize/character_counter.js +0 -59
- data/app/assets/javascripts/materialize/collapsible.js +0 -139
- data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -1430
- data/app/assets/javascripts/materialize/date_picker/picker.js +0 -1123
- data/app/assets/javascripts/materialize/dropdown.js +0 -178
- data/app/assets/javascripts/materialize/forms.js +0 -456
- data/app/assets/javascripts/materialize/global.js +0 -36
- data/app/assets/javascripts/materialize/hammer.min.js +0 -1
- data/app/assets/javascripts/materialize/init.js +0 -136
- data/app/assets/javascripts/materialize/jquery.easing.1.3.js +0 -205
- data/app/assets/javascripts/materialize/jquery.hammer.js +0 -33
- data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -1
- data/app/assets/javascripts/materialize/leanModal.js +0 -178
- data/app/assets/javascripts/materialize/materialbox.js +0 -249
- data/app/assets/javascripts/materialize/parallax.js +0 -58
- data/app/assets/javascripts/materialize/prism.js +0 -8
- data/app/assets/javascripts/materialize/pushpin.js +0 -62
- data/app/assets/javascripts/materialize/scrollFire.js +0 -44
- data/app/assets/javascripts/materialize/scrollspy.js +0 -284
- data/app/assets/javascripts/materialize/sideNav.js +0 -312
- data/app/assets/javascripts/materialize/slider.js +0 -301
- data/app/assets/javascripts/materialize/tabs.js +0 -136
- data/app/assets/javascripts/materialize/toasts.js +0 -125
- data/app/assets/javascripts/materialize/tooltip.js +0 -166
- data/app/assets/javascripts/materialize/transitions.js +0 -154
- data/app/assets/javascripts/materialize/velocity.min.js +0 -4
- data/app/assets/javascripts/materialize-sprockets.js +0 -27
- data/app/assets/javascripts/materialize.js +0 -6159
- data/app/assets/stylesheets/materialize/components/_buttons.scss +0 -157
- data/app/assets/stylesheets/materialize/components/_dropdown.scss +0 -40
- data/app/assets/stylesheets/materialize/components/_form.scss +0 -886
- data/app/assets/stylesheets/materialize/components/_icons-material-design.scss +0 -3257
- data/app/assets/stylesheets/materialize/components/_mixins.scss +0 -5
- data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -427
- data/app/assets/stylesheets/materialize/components/_prefixer.scss +0 -376
- data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -38
- data/app/assets/stylesheets/materialize/components/_sideNav.scss +0 -111
- data/app/assets/stylesheets/materialize/components/_tabs.scss +0 -47
- data/app/assets/stylesheets/materialize/components/_tooltip.scss +0 -34
- data/app/assets/stylesheets/materialize/components/_variables.scss +0 -152
- data/app/assets/stylesheets/materialize/components/_waves.scss +0 -167
- data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +0 -435
- data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +0 -201
- data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +0 -125
@@ -0,0 +1,424 @@
|
|
1
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
2
|
+
|
3
|
+
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
|
4
|
+
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
|
+
|
7
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
8
|
+
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
10
|
+
|
11
|
+
(function ($, anim) {
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
var _defaults = {
|
15
|
+
indicators: true,
|
16
|
+
height: 400,
|
17
|
+
duration: 500,
|
18
|
+
interval: 6000
|
19
|
+
};
|
20
|
+
|
21
|
+
/**
|
22
|
+
* @class
|
23
|
+
*
|
24
|
+
*/
|
25
|
+
|
26
|
+
var Slider = function (_Component) {
|
27
|
+
_inherits(Slider, _Component);
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Construct Slider instance and set up overlay
|
31
|
+
* @constructor
|
32
|
+
* @param {Element} el
|
33
|
+
* @param {Object} options
|
34
|
+
*/
|
35
|
+
function Slider(el, options) {
|
36
|
+
_classCallCheck(this, Slider);
|
37
|
+
|
38
|
+
var _this = _possibleConstructorReturn(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).call(this, Slider, el, options));
|
39
|
+
|
40
|
+
_this.el.M_Slider = _this;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Options for the modal
|
44
|
+
* @member Slider#options
|
45
|
+
* @prop {Boolean} [indicators=true] - Show indicators
|
46
|
+
* @prop {Number} [height=400] - height of slider
|
47
|
+
* @prop {Number} [duration=500] - Length in ms of slide transition
|
48
|
+
* @prop {Number} [interval=6000] - Length in ms of slide interval
|
49
|
+
*/
|
50
|
+
_this.options = $.extend({}, Slider.defaults, options);
|
51
|
+
|
52
|
+
// setup
|
53
|
+
_this.$slider = _this.$el.find('.slides');
|
54
|
+
_this.$slides = _this.$slider.children('li');
|
55
|
+
_this.activeIndex = _this.$slides.filter(function (item) {
|
56
|
+
return $(item).hasClass('active');
|
57
|
+
}).first().index();
|
58
|
+
if (_this.activeIndex != -1) {
|
59
|
+
_this.$active = _this.$slides.eq(_this.activeIndex);
|
60
|
+
}
|
61
|
+
|
62
|
+
_this._setSliderHeight();
|
63
|
+
|
64
|
+
// Set initial positions of captions
|
65
|
+
_this.$slides.find('.caption').each(function (el) {
|
66
|
+
_this._animateCaptionIn(el, 0);
|
67
|
+
});
|
68
|
+
|
69
|
+
// Move img src into background-image
|
70
|
+
_this.$slides.find('img').each(function (el) {
|
71
|
+
var placeholderBase64 = 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
72
|
+
if ($(el).attr('src') !== placeholderBase64) {
|
73
|
+
$(el).css('background-image', 'url("' + $(el).attr('src') + '")');
|
74
|
+
$(el).attr('src', placeholderBase64);
|
75
|
+
}
|
76
|
+
});
|
77
|
+
|
78
|
+
_this._setupIndicators();
|
79
|
+
|
80
|
+
// Show active slide
|
81
|
+
if (_this.$active) {
|
82
|
+
_this.$active.css('display', 'block');
|
83
|
+
} else {
|
84
|
+
_this.$slides.first().addClass('active');
|
85
|
+
anim({
|
86
|
+
targets: _this.$slides.first()[0],
|
87
|
+
opacity: 1,
|
88
|
+
duration: _this.options.duration,
|
89
|
+
easing: 'easeOutQuad'
|
90
|
+
});
|
91
|
+
|
92
|
+
_this.activeIndex = 0;
|
93
|
+
_this.$active = _this.$slides.eq(_this.activeIndex);
|
94
|
+
|
95
|
+
// Update indicators
|
96
|
+
if (_this.options.indicators) {
|
97
|
+
_this.$indicators.eq(_this.activeIndex).addClass('active');
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
// Adjust height to current slide
|
102
|
+
_this.$active.find('img').each(function (el) {
|
103
|
+
anim({
|
104
|
+
targets: _this.$active.find('.caption')[0],
|
105
|
+
opacity: 1,
|
106
|
+
translateX: 0,
|
107
|
+
translateY: 0,
|
108
|
+
duration: _this.options.duration,
|
109
|
+
easing: 'easeOutQuad'
|
110
|
+
});
|
111
|
+
});
|
112
|
+
|
113
|
+
_this._setupEventHandlers();
|
114
|
+
|
115
|
+
// auto scroll
|
116
|
+
_this.start();
|
117
|
+
return _this;
|
118
|
+
}
|
119
|
+
|
120
|
+
_createClass(Slider, [{
|
121
|
+
key: 'destroy',
|
122
|
+
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Teardown component
|
126
|
+
*/
|
127
|
+
value: function destroy() {
|
128
|
+
this.pause();
|
129
|
+
this._removeIndicators();
|
130
|
+
this._removeEventHandlers();
|
131
|
+
this.el.M_Slider = undefined;
|
132
|
+
}
|
133
|
+
|
134
|
+
/**
|
135
|
+
* Setup Event Handlers
|
136
|
+
*/
|
137
|
+
|
138
|
+
}, {
|
139
|
+
key: '_setupEventHandlers',
|
140
|
+
value: function _setupEventHandlers() {
|
141
|
+
var _this2 = this;
|
142
|
+
|
143
|
+
this._handleIntervalBound = this._handleInterval.bind(this);
|
144
|
+
this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this);
|
145
|
+
|
146
|
+
if (this.options.indicators) {
|
147
|
+
this.$indicators.each(function (el) {
|
148
|
+
el.addEventListener('click', _this2._handleIndicatorClickBound);
|
149
|
+
});
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Remove Event Handlers
|
155
|
+
*/
|
156
|
+
|
157
|
+
}, {
|
158
|
+
key: '_removeEventHandlers',
|
159
|
+
value: function _removeEventHandlers() {
|
160
|
+
var _this3 = this;
|
161
|
+
|
162
|
+
if (this.options.indicators) {
|
163
|
+
this.$indicators.each(function (el) {
|
164
|
+
el.removeEventListener('click', _this3._handleIndicatorClickBound);
|
165
|
+
});
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Handle indicator click
|
171
|
+
* @param {Event} e
|
172
|
+
*/
|
173
|
+
|
174
|
+
}, {
|
175
|
+
key: '_handleIndicatorClick',
|
176
|
+
value: function _handleIndicatorClick(e) {
|
177
|
+
var currIndex = $(e.target).index();
|
178
|
+
this.set(currIndex);
|
179
|
+
}
|
180
|
+
|
181
|
+
/**
|
182
|
+
* Handle Interval
|
183
|
+
*/
|
184
|
+
|
185
|
+
}, {
|
186
|
+
key: '_handleInterval',
|
187
|
+
value: function _handleInterval() {
|
188
|
+
var newActiveIndex = this.$slider.find('.active').index();
|
189
|
+
if (this.$slides.length === newActiveIndex + 1) newActiveIndex = 0;
|
190
|
+
// loop to start
|
191
|
+
else newActiveIndex += 1;
|
192
|
+
|
193
|
+
this.set(newActiveIndex);
|
194
|
+
}
|
195
|
+
|
196
|
+
/**
|
197
|
+
* Animate in caption
|
198
|
+
* @param {Element} caption
|
199
|
+
* @param {Number} duration
|
200
|
+
*/
|
201
|
+
|
202
|
+
}, {
|
203
|
+
key: '_animateCaptionIn',
|
204
|
+
value: function _animateCaptionIn(caption, duration) {
|
205
|
+
var animOptions = {
|
206
|
+
targets: caption,
|
207
|
+
opacity: 0,
|
208
|
+
duration: duration,
|
209
|
+
easing: 'easeOutQuad'
|
210
|
+
};
|
211
|
+
|
212
|
+
if ($(caption).hasClass('center-align')) {
|
213
|
+
animOptions.translateY = -100;
|
214
|
+
} else if ($(caption).hasClass('right-align')) {
|
215
|
+
animOptions.translateX = 100;
|
216
|
+
} else if ($(caption).hasClass('left-align')) {
|
217
|
+
animOptions.translateX = -100;
|
218
|
+
}
|
219
|
+
|
220
|
+
anim(animOptions);
|
221
|
+
}
|
222
|
+
|
223
|
+
/**
|
224
|
+
* Set height of slider
|
225
|
+
*/
|
226
|
+
|
227
|
+
}, {
|
228
|
+
key: '_setSliderHeight',
|
229
|
+
value: function _setSliderHeight() {
|
230
|
+
// If fullscreen, do nothing
|
231
|
+
if (!this.$el.hasClass('fullscreen')) {
|
232
|
+
if (this.options.indicators) {
|
233
|
+
// Add height if indicators are present
|
234
|
+
this.$el.css('height', this.options.height + 40 + 'px');
|
235
|
+
} else {
|
236
|
+
this.$el.css('height', this.options.height + 'px');
|
237
|
+
}
|
238
|
+
this.$slider.css('height', this.options.height + 'px');
|
239
|
+
}
|
240
|
+
}
|
241
|
+
|
242
|
+
/**
|
243
|
+
* Setup indicators
|
244
|
+
*/
|
245
|
+
|
246
|
+
}, {
|
247
|
+
key: '_setupIndicators',
|
248
|
+
value: function _setupIndicators() {
|
249
|
+
var _this4 = this;
|
250
|
+
|
251
|
+
if (this.options.indicators) {
|
252
|
+
this.$indicators = $('<ul class="indicators"></ul>');
|
253
|
+
this.$slides.each(function (el, index) {
|
254
|
+
var $indicator = $('<li class="indicator-item"></li>');
|
255
|
+
_this4.$indicators.append($indicator[0]);
|
256
|
+
});
|
257
|
+
this.$el.append(this.$indicators[0]);
|
258
|
+
this.$indicators = this.$indicators.children('li.indicator-item');
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
262
|
+
/**
|
263
|
+
* Remove indicators
|
264
|
+
*/
|
265
|
+
|
266
|
+
}, {
|
267
|
+
key: '_removeIndicators',
|
268
|
+
value: function _removeIndicators() {
|
269
|
+
this.$el.find('ul.indicators').remove();
|
270
|
+
}
|
271
|
+
|
272
|
+
/**
|
273
|
+
* Cycle to nth item
|
274
|
+
* @param {Number} index
|
275
|
+
*/
|
276
|
+
|
277
|
+
}, {
|
278
|
+
key: 'set',
|
279
|
+
value: function set(index) {
|
280
|
+
var _this5 = this;
|
281
|
+
|
282
|
+
// Wrap around indices.
|
283
|
+
if (index >= this.$slides.length) index = 0;else if (index < 0) index = this.$slides.length - 1;
|
284
|
+
|
285
|
+
// Only do if index changes
|
286
|
+
if (this.activeIndex != index) {
|
287
|
+
this.$active = this.$slides.eq(this.activeIndex);
|
288
|
+
var $caption = this.$active.find('.caption');
|
289
|
+
this.$active.removeClass('active');
|
290
|
+
|
291
|
+
anim({
|
292
|
+
targets: this.$active[0],
|
293
|
+
opacity: 0,
|
294
|
+
duration: this.options.duration,
|
295
|
+
easing: 'easeOutQuad',
|
296
|
+
complete: function () {
|
297
|
+
_this5.$slides.not('.active').each(function (el) {
|
298
|
+
anim({
|
299
|
+
targets: el,
|
300
|
+
opacity: 0,
|
301
|
+
translateX: 0,
|
302
|
+
translateY: 0,
|
303
|
+
duration: 0,
|
304
|
+
easing: 'easeOutQuad'
|
305
|
+
});
|
306
|
+
});
|
307
|
+
}
|
308
|
+
});
|
309
|
+
|
310
|
+
this._animateCaptionIn($caption[0], this.options.duration);
|
311
|
+
|
312
|
+
// Update indicators
|
313
|
+
if (this.options.indicators) {
|
314
|
+
this.$indicators.eq(this.activeIndex).removeClass('active');
|
315
|
+
this.$indicators.eq(index).addClass('active');
|
316
|
+
}
|
317
|
+
|
318
|
+
anim({
|
319
|
+
targets: this.$slides.eq(index)[0],
|
320
|
+
opacity: 1,
|
321
|
+
duration: this.options.duration,
|
322
|
+
easing: 'easeOutQuad'
|
323
|
+
});
|
324
|
+
|
325
|
+
anim({
|
326
|
+
targets: this.$slides.eq(index).find('.caption')[0],
|
327
|
+
opacity: 1,
|
328
|
+
translateX: 0,
|
329
|
+
translateY: 0,
|
330
|
+
duration: this.options.duration,
|
331
|
+
delay: this.options.duration,
|
332
|
+
easing: 'easeOutQuad'
|
333
|
+
});
|
334
|
+
|
335
|
+
this.$slides.eq(index).addClass('active');
|
336
|
+
this.activeIndex = index;
|
337
|
+
|
338
|
+
// Reset interval
|
339
|
+
this.start();
|
340
|
+
}
|
341
|
+
}
|
342
|
+
|
343
|
+
/**
|
344
|
+
* Pause slider interval
|
345
|
+
*/
|
346
|
+
|
347
|
+
}, {
|
348
|
+
key: 'pause',
|
349
|
+
value: function pause() {
|
350
|
+
clearInterval(this.interval);
|
351
|
+
}
|
352
|
+
|
353
|
+
/**
|
354
|
+
* Start slider interval
|
355
|
+
*/
|
356
|
+
|
357
|
+
}, {
|
358
|
+
key: 'start',
|
359
|
+
value: function start() {
|
360
|
+
clearInterval(this.interval);
|
361
|
+
this.interval = setInterval(this._handleIntervalBound, this.options.duration + this.options.interval);
|
362
|
+
}
|
363
|
+
|
364
|
+
/**
|
365
|
+
* Move to next slide
|
366
|
+
*/
|
367
|
+
|
368
|
+
}, {
|
369
|
+
key: 'next',
|
370
|
+
value: function next() {
|
371
|
+
var newIndex = this.activeIndex + 1;
|
372
|
+
|
373
|
+
// Wrap around indices.
|
374
|
+
if (newIndex >= this.$slides.length) newIndex = 0;else if (newIndex < 0) newIndex = this.$slides.length - 1;
|
375
|
+
|
376
|
+
this.set(newIndex);
|
377
|
+
}
|
378
|
+
|
379
|
+
/**
|
380
|
+
* Move to previous slide
|
381
|
+
*/
|
382
|
+
|
383
|
+
}, {
|
384
|
+
key: 'prev',
|
385
|
+
value: function prev() {
|
386
|
+
var newIndex = this.activeIndex - 1;
|
387
|
+
|
388
|
+
// Wrap around indices.
|
389
|
+
if (newIndex >= this.$slides.length) newIndex = 0;else if (newIndex < 0) newIndex = this.$slides.length - 1;
|
390
|
+
|
391
|
+
this.set(newIndex);
|
392
|
+
}
|
393
|
+
}], [{
|
394
|
+
key: 'init',
|
395
|
+
value: function init(els, options) {
|
396
|
+
return _get(Slider.__proto__ || Object.getPrototypeOf(Slider), 'init', this).call(this, this, els, options);
|
397
|
+
}
|
398
|
+
|
399
|
+
/**
|
400
|
+
* Get Instance
|
401
|
+
*/
|
402
|
+
|
403
|
+
}, {
|
404
|
+
key: 'getInstance',
|
405
|
+
value: function getInstance(el) {
|
406
|
+
var domElem = !!el.jquery ? el[0] : el;
|
407
|
+
return domElem.M_Slider;
|
408
|
+
}
|
409
|
+
}, {
|
410
|
+
key: 'defaults',
|
411
|
+
get: function () {
|
412
|
+
return _defaults;
|
413
|
+
}
|
414
|
+
}]);
|
415
|
+
|
416
|
+
return Slider;
|
417
|
+
}(Component);
|
418
|
+
|
419
|
+
M.Slider = Slider;
|
420
|
+
|
421
|
+
if (M.jQueryLoaded) {
|
422
|
+
M.initializeJqueryWrapper(Slider, 'slider', 'M_Slider');
|
423
|
+
}
|
424
|
+
})(cash, M.anime);
|