materialize-sass 1.0.0.alpha2 → 1.0.0.alpha3

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.
Files changed (38) hide show
  1. checksums.yaml +5 -5
  2. data/assets/javascripts/materialize-sprockets.js +1 -0
  3. data/assets/javascripts/materialize.js +1337 -1281
  4. data/assets/javascripts/materialize/autocomplete.js +27 -27
  5. data/assets/javascripts/materialize/buttons.js +58 -58
  6. data/assets/javascripts/materialize/carousel.js +47 -49
  7. data/assets/javascripts/materialize/cash.js +4 -4
  8. data/assets/javascripts/materialize/characterCounter.js +20 -20
  9. data/assets/javascripts/materialize/chips.js +42 -38
  10. data/assets/javascripts/materialize/collapsible.js +27 -27
  11. data/assets/javascripts/materialize/component.js +57 -0
  12. data/assets/javascripts/materialize/datepicker.js +59 -53
  13. data/assets/javascripts/materialize/dropdown.js +43 -43
  14. data/assets/javascripts/materialize/extras/nouislider.js +1 -1
  15. data/assets/javascripts/materialize/extras/nouislider.min.js +1 -1
  16. data/assets/javascripts/materialize/forms.js +8 -2
  17. data/assets/javascripts/materialize/global.js +11 -13
  18. data/assets/javascripts/materialize/materialbox.js +72 -44
  19. data/assets/javascripts/materialize/modal.js +55 -38
  20. data/assets/javascripts/materialize/parallax.js +61 -24
  21. data/assets/javascripts/materialize/pushpin.js +37 -21
  22. data/assets/javascripts/materialize/range.js +19 -21
  23. data/assets/javascripts/materialize/scrollspy.js +23 -23
  24. data/assets/javascripts/materialize/select.js +42 -36
  25. data/assets/javascripts/materialize/sidenav.js +34 -34
  26. data/assets/javascripts/materialize/slider.js +37 -39
  27. data/assets/javascripts/materialize/tabs.js +42 -49
  28. data/assets/javascripts/materialize/tapTarget.js +39 -22
  29. data/assets/javascripts/materialize/timepicker.js +579 -579
  30. data/assets/javascripts/materialize/tooltip.js +34 -31
  31. data/assets/stylesheets/materialize/components/_cards.scss +0 -2
  32. data/assets/stylesheets/materialize/components/_global.scss +4 -14
  33. data/assets/stylesheets/materialize/components/_typography.scss +0 -1
  34. data/assets/stylesheets/materialize/components/_variables.scss +1 -1
  35. data/assets/stylesheets/materialize/components/forms/_checkboxes.scss +0 -10
  36. data/assets/stylesheets/materialize/extras/nouislider.css +1 -1
  37. data/lib/materialize-sass/version.rb +1 -1
  38. metadata +4 -3
@@ -65,24 +65,22 @@ M.initializeJqueryWrapper = function (plugin, pluginName, classRef) {
65
65
  if (methodOrOptions.slice(0, 3) === 'get') {
66
66
  var instance = this.first()[0][classRef];
67
67
  return instance[methodOrOptions].apply(instance, params);
68
-
69
- // Void methods
70
- } else {
71
- return this.each(function () {
72
- var instance = this[classRef];
73
- instance[methodOrOptions].apply(instance, params);
74
- });
75
68
  }
76
69
 
70
+ // Void methods
71
+ return this.each(function () {
72
+ var instance = this[classRef];
73
+ instance[methodOrOptions].apply(instance, params);
74
+ });
75
+
77
76
  // Initialize plugin if options or no argument is passed in
78
77
  } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
79
78
  plugin.init(this, arguments[0]);
80
79
  return this;
81
-
82
- // Return error if an unrecognized method name is passed in
83
- } else {
84
- jQuery.error("Method " + methodOrOptions + " does not exist on jQuery." + pluginName);
85
80
  }
81
+
82
+ // Return error if an unrecognized method name is passed in
83
+ jQuery.error("Method " + methodOrOptions + " does not exist on jQuery." + pluginName);
86
84
  };
87
85
  };
88
86
 
@@ -245,9 +243,9 @@ M.getOverflowParent = function (element) {
245
243
 
246
244
  if (element === document.body || getComputedStyle(element).overflow !== 'visible') {
247
245
  return element;
248
- } else {
249
- return M.getOverflowParent(element.parentElement);
250
246
  }
247
+
248
+ return M.getOverflowParent(element.parentElement);
251
249
  };
252
250
 
253
251
  /**
@@ -1,13 +1,23 @@
1
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
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
+
3
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
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
+
5
11
  (function ($, anim) {
6
12
  'use strict';
7
13
 
8
14
  var _defaults = {
9
15
  inDuration: 275,
10
- outDuration: 200
16
+ outDuration: 200,
17
+ onOpenStart: null,
18
+ onOpenEnd: null,
19
+ onCloseStart: null,
20
+ onCloseEnd: null
11
21
  };
12
22
 
13
23
  /**
@@ -15,7 +25,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
15
25
  *
16
26
  */
17
27
 
18
- var Materialbox = function () {
28
+ var Materialbox = function (_Component) {
29
+ _inherits(Materialbox, _Component);
30
+
19
31
  /**
20
32
  * Construct Materialbox instance
21
33
  * @constructor
@@ -25,36 +37,36 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
25
37
  function Materialbox(el, options) {
26
38
  _classCallCheck(this, Materialbox);
27
39
 
28
- // If exists, destroy and reinitialize
29
- if (!!el.M_Materialbox) {
30
- el.M_Materialbox.destroy();
31
- }
40
+ var _this = _possibleConstructorReturn(this, (Materialbox.__proto__ || Object.getPrototypeOf(Materialbox)).call(this, Materialbox, el, options));
32
41
 
33
- this.el = el;
34
- this.$el = $(el);
35
- this.el.M_Materialbox = this;
42
+ _this.el.M_Materialbox = _this;
36
43
 
37
44
  /**
38
45
  * Options for the modal
39
46
  * @member Materialbox#options
40
47
  * @prop {Number} [inDuration=275] - Length in ms of enter transition
41
48
  * @prop {Number} [outDuration=200] - Length in ms of exit transition
49
+ * @prop {Function} onOpenStart - Callback function called before materialbox is opened
50
+ * @prop {Function} onOpenEnd - Callback function called after materialbox is opened
51
+ * @prop {Function} onCloseStart - Callback function called before materialbox is closed
52
+ * @prop {Function} onCloseEnd - Callback function called after materialbox is closed
42
53
  */
43
- this.options = $.extend({}, Materialbox.defaults, options);
54
+ _this.options = $.extend({}, Materialbox.defaults, options);
44
55
 
45
- this.overlayActive = false;
46
- this.doneAnimating = true;
47
- this.placeholder = $('<div></div>').addClass('material-placeholder');
48
- this.originalWidth = 0;
49
- this.originalHeight = 0;
50
- this.originInlineStyles = this.$el.attr('style');
51
- this.caption = this.el.getAttribute('data-caption') || "";
56
+ _this.overlayActive = false;
57
+ _this.doneAnimating = true;
58
+ _this.placeholder = $('<div></div>').addClass('material-placeholder');
59
+ _this.originalWidth = 0;
60
+ _this.originalHeight = 0;
61
+ _this.originInlineStyles = _this.$el.attr('style');
62
+ _this.caption = _this.el.getAttribute('data-caption') || "";
52
63
 
53
64
  // Wrap
54
- this.$el.before(this.placeholder);
55
- this.placeholder.append(this.$el);
65
+ _this.$el.before(_this.placeholder);
66
+ _this.placeholder.append(_this.$el);
56
67
 
57
- this._setupEventHandlers();
68
+ _this._setupEventHandlers();
69
+ return _this;
58
70
  }
59
71
 
60
72
  _createClass(Materialbox, [{
@@ -174,7 +186,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
174
186
  }, {
175
187
  key: '_animateImageIn',
176
188
  value: function _animateImageIn() {
177
- var _this = this;
189
+ var _this2 = this;
178
190
 
179
191
  var animOptions = {
180
192
  targets: this.el,
@@ -185,7 +197,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
185
197
  duration: this.options.inDuration,
186
198
  easing: 'easeOutQuad',
187
199
  complete: function () {
188
- _this.doneAnimating = true;
200
+ _this2.doneAnimating = true;
201
+
202
+ // onOpenEnd callback
203
+ if (typeof _this2.options.onOpenEnd === 'function') {
204
+ _this2.options.onOpenEnd.call(_this2, _this2.el);
205
+ }
189
206
  }
190
207
  };
191
208
 
@@ -207,7 +224,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
207
224
  }, {
208
225
  key: '_animateImageOut',
209
226
  value: function _animateImageOut() {
210
- var _this2 = this;
227
+ var _this3 = this;
211
228
 
212
229
  var animOptions = {
213
230
  targets: this.el,
@@ -218,7 +235,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
218
235
  duration: this.options.outDuration,
219
236
  easing: 'easeOutQuad',
220
237
  complete: function () {
221
- _this2.placeholder.css({
238
+ _this3.placeholder.css({
222
239
  height: '',
223
240
  width: '',
224
241
  position: '',
@@ -226,16 +243,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
226
243
  left: ''
227
244
  });
228
245
 
229
- _this2.$el.removeAttr('style');
230
- _this2.$el.attr('style', _this2.originInlineStyles);
246
+ _this3.$el.removeAttr('style');
247
+ _this3.$el.attr('style', _this3.originInlineStyles);
231
248
 
232
249
  // Remove class
233
- _this2.$el.removeClass('active');
234
- _this2.doneAnimating = true;
250
+ _this3.$el.removeClass('active');
251
+ _this3.doneAnimating = true;
235
252
 
236
253
  // Remove overflow overrides on ancestors
237
- if (_this2.ancestorsChanged.length) {
238
- _this2.ancestorsChanged.css('overflow', '');
254
+ if (_this3.ancestorsChanged.length) {
255
+ _this3.ancestorsChanged.css('overflow', '');
256
+ }
257
+
258
+ // onCloseEnd callback
259
+ if (typeof _this3.options.onCloseEnd === 'function') {
260
+ _this3.options.onCloseEnd.call(_this3, _this3.el);
239
261
  }
240
262
  }
241
263
  };
@@ -262,7 +284,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
262
284
  }, {
263
285
  key: 'open',
264
286
  value: function open() {
265
- var _this3 = this;
287
+ var _this4 = this;
266
288
 
267
289
  this._updateVars();
268
290
  this.originalWidth = this.el.getBoundingClientRect().width;
@@ -273,6 +295,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
273
295
  this.$el.addClass('active');
274
296
  this.overlayActive = true;
275
297
 
298
+ // onOpenStart callback
299
+ if (typeof this.options.onOpenStart === 'function') {
300
+ this.options.onOpenStart.call(this, this.el);
301
+ }
302
+
276
303
  // Set positioning for placeholder
277
304
  this.placeholder.css({
278
305
  width: this.placeholder[0].getBoundingClientRect().width + 'px',
@@ -295,8 +322,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
295
322
  this.$overlay = $('<div id="materialbox-overlay"></div>').css({
296
323
  opacity: 0
297
324
  }).one('click', function () {
298
- if (_this3.doneAnimating) {
299
- _this3.close();
325
+ if (_this4.doneAnimating) {
326
+ _this4.close();
300
327
  }
301
328
  });
302
329
 
@@ -378,11 +405,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
378
405
  }, {
379
406
  key: 'close',
380
407
  value: function close() {
381
- var _this4 = this;
408
+ var _this5 = this;
382
409
 
383
410
  this._updateVars();
384
411
  this.doneAnimating = false;
385
412
 
413
+ // onCloseStart callback
414
+ if (typeof this.options.onCloseStart === 'function') {
415
+ this.options.onCloseStart.call(this, this.el);
416
+ }
417
+
386
418
  anim.remove(this.el);
387
419
  anim.remove(this.$overlay[0]);
388
420
 
@@ -401,8 +433,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
401
433
  duration: this.options.outDuration,
402
434
  easing: 'easeOutQuad',
403
435
  complete: function () {
404
- _this4.overlayActive = false;
405
- _this4.$overlay.remove();
436
+ _this5.overlayActive = false;
437
+ _this5.$overlay.remove();
406
438
  }
407
439
  });
408
440
 
@@ -416,19 +448,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
416
448
  duration: this.options.outDuration,
417
449
  easing: 'easeOutQuad',
418
450
  complete: function () {
419
- _this4.$photoCaption.remove();
451
+ _this5.$photoCaption.remove();
420
452
  }
421
453
  });
422
454
  }
423
455
  }
424
456
  }], [{
425
457
  key: 'init',
426
- value: function init($els, options) {
427
- var arr = [];
428
- $els.each(function () {
429
- arr.push(new Materialbox(this, options));
430
- });
431
- return arr;
458
+ value: function init(els, options) {
459
+ return _get(Materialbox.__proto__ || Object.getPrototypeOf(Materialbox), 'init', this).call(this, this, els, options);
432
460
  }
433
461
 
434
462
  /**
@@ -449,7 +477,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
449
477
  }]);
450
478
 
451
479
  return Materialbox;
452
- }();
480
+ }(Component);
453
481
 
454
482
  M.Materialbox = Materialbox;
455
483
 
@@ -1,7 +1,13 @@
1
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
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
+
3
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
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
+
5
11
  (function ($, anim) {
6
12
  'use strict';
7
13
 
@@ -9,8 +15,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
9
15
  opacity: 0.5,
10
16
  inDuration: 250,
11
17
  outDuration: 250,
12
- ready: undefined,
13
- complete: undefined,
18
+ onOpenStart: null,
19
+ onOpenEnd: null,
20
+ onCloseStart: null,
21
+ onCloseEnd: null,
14
22
  dismissible: true,
15
23
  startingTop: '4%',
16
24
  endingTop: '10%'
@@ -21,7 +29,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
21
29
  *
22
30
  */
23
31
 
24
- var Modal = function () {
32
+ var Modal = function (_Component) {
33
+ _inherits(Modal, _Component);
34
+
25
35
  /**
26
36
  * Construct Modal instance and set up overlay
27
37
  * @constructor
@@ -31,14 +41,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
31
41
  function Modal(el, options) {
32
42
  _classCallCheck(this, Modal);
33
43
 
34
- // If exists, destroy and reinitialize
35
- if (!!el.M_Modal) {
36
- el.M_Modal.destroy();
37
- }
44
+ var _this = _possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, Modal, el, options));
38
45
 
39
- this.el = el;
40
- this.$el = $(el);
41
- this.el.M_Modal = this;
46
+ _this.el.M_Modal = _this;
42
47
 
43
48
  /**
44
49
  * Options for the modal
@@ -46,29 +51,32 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
46
51
  * @prop {Number} [opacity=0.5] - Opacity of the modal overlay
47
52
  * @prop {Number} [inDuration=250] - Length in ms of enter transition
48
53
  * @prop {Number} [outDuration=250] - Length in ms of exit transition
49
- * @prop {Function} ready - Callback function called when modal is finished entering
50
- * @prop {Function} complete - Callback function called when modal is finished exiting
54
+ * @prop {Function} onOpenStart - Callback function called before modal is opened
55
+ * @prop {Function} onOpenEnd - Callback function called after modal is opened
56
+ * @prop {Function} onCloseStart - Callback function called before modal is closed
57
+ * @prop {Function} onCloseEnd - Callback function called after modal is closed
51
58
  * @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
52
59
  * @prop {String} [startingTop='4%'] - startingTop
53
60
  * @prop {String} [endingTop='10%'] - endingTop
54
61
  */
55
- this.options = $.extend({}, Modal.defaults, options);
62
+ _this.options = $.extend({}, Modal.defaults, options);
56
63
 
57
64
  /**
58
65
  * Describes open/close state of modal
59
66
  * @type {Boolean}
60
67
  */
61
- this.isOpen = false;
68
+ _this.isOpen = false;
62
69
 
63
- this.id = this.$el.attr('id');
64
- this._openingTrigger = undefined;
65
- this.$overlay = $('<div class="modal-overlay"></div>');
70
+ _this.id = _this.$el.attr('id');
71
+ _this._openingTrigger = undefined;
72
+ _this.$overlay = $('<div class="modal-overlay"></div>');
66
73
 
67
74
  Modal._increment++;
68
75
  Modal._count++;
69
- this.$overlay[0].style.zIndex = 1000 + Modal._increment * 2;
70
- this.el.style.zIndex = 1000 + Modal._increment * 2 + 1;
71
- this._setupEventHandlers();
76
+ _this.$overlay[0].style.zIndex = 1000 + Modal._increment * 2;
77
+ _this.el.style.zIndex = 1000 + Modal._increment * 2 + 1;
78
+ _this._setupEventHandlers();
79
+ return _this;
72
80
  }
73
81
 
74
82
  _createClass(Modal, [{
@@ -183,7 +191,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
183
191
  }, {
184
192
  key: '_animateIn',
185
193
  value: function _animateIn() {
186
- var _this = this;
194
+ var _this2 = this;
187
195
 
188
196
  // Set initial styles
189
197
  $.extend(this.el.style, {
@@ -208,10 +216,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
208
216
  targets: this.el,
209
217
  duration: this.options.inDuration,
210
218
  easing: 'easeOutCubic',
211
- // Handle modal ready callback
219
+ // Handle modal onOpenEnd callback
212
220
  complete: function () {
213
- if (typeof _this.options.ready === 'function') {
214
- _this.options.ready.call(_this, _this.el, _this._openingTrigger);
221
+ if (typeof _this2.options.onOpenEnd === 'function') {
222
+ _this2.options.onOpenEnd.call(_this2, _this2.el, _this2._openingTrigger);
215
223
  }
216
224
  }
217
225
  };
@@ -243,7 +251,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
243
251
  }, {
244
252
  key: '_animateOut',
245
253
  value: function _animateOut() {
246
- var _this2 = this;
254
+ var _this3 = this;
247
255
 
248
256
  // Animate overlay
249
257
  anim({
@@ -260,12 +268,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
260
268
  easing: 'easeOutCubic',
261
269
  // Handle modal ready callback
262
270
  complete: function () {
263
- _this2.el.style.display = 'none';
264
- // Call complete callback
265
- if (typeof _this2.options.complete === 'function') {
266
- _this2.options.complete.call(_this2, _this2.el);
271
+ _this3.el.style.display = 'none';
272
+ _this3.$overlay.remove();
273
+
274
+ // Call onCloseEnd callback
275
+ if (typeof _this3.options.onCloseEnd === 'function') {
276
+ _this3.options.onCloseEnd.call(_this3, _this3.el);
267
277
  }
268
- _this2.$overlay.remove();
269
278
  }
270
279
  };
271
280
 
@@ -302,10 +311,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
302
311
  }
303
312
 
304
313
  this.isOpen = true;
314
+
315
+ // onOpenStart callback
316
+ if (typeof this.options.onOpenStart === 'function') {
317
+ this.options.onOpenStart.call(this, this.el, this._openingTrigger);
318
+ }
319
+
305
320
  var body = document.body;
306
321
  body.style.overflow = 'hidden';
307
322
  this.el.classList.add('open');
308
- body.appendChild(this.$overlay[0]);
323
+ this.el.insertAdjacentElement('afterend', this.$overlay[0]);
309
324
 
310
325
  // Set opening trigger, undefined indicates modal was opened by javascript
311
326
  this._openingTrigger = !!$trigger ? $trigger[0] : undefined;
@@ -333,6 +348,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
333
348
  }
334
349
 
335
350
  this.isOpen = false;
351
+
352
+ // Call onCloseStart callback
353
+ if (typeof this.options.onCloseStart === 'function') {
354
+ this.options.onCloseStart.call(this, this.el);
355
+ }
356
+
336
357
  this.el.classList.remove('open');
337
358
  document.body.style.overflow = '';
338
359
 
@@ -347,12 +368,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
347
368
  }
348
369
  }], [{
349
370
  key: 'init',
350
- value: function init($els, options) {
351
- var arr = [];
352
- $els.each(function () {
353
- arr.push(new Modal(this, options));
354
- });
355
- return arr;
371
+ value: function init(els, options) {
372
+ return _get(Modal.__proto__ || Object.getPrototypeOf(Modal), 'init', this).call(this, this, els, options);
356
373
  }
357
374
 
358
375
  /**
@@ -373,7 +390,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
373
390
  }]);
374
391
 
375
392
  return Modal;
376
- }();
393
+ }(Component);
377
394
 
378
395
  /**
379
396
  * @static