mtl 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mtl/dropdown.coffee +1 -1
- data/app/assets/stylesheets/mtl/extend/_chips.scss +20 -0
- data/app/assets/stylesheets/mtl/extend/_side-nav.scss +4 -2
- data/lib/generators/mtl/templates/_variables.scss +5 -0
- data/lib/mtl/version.rb +2 -2
- data/mtl.gemspec +11 -0
- data/package.json +1 -1
- data/vendor/assets/javascripts/materialize/animation.js +8 -9
- data/vendor/assets/javascripts/materialize/carousel.js +51 -24
- data/vendor/assets/javascripts/materialize/character_counter.js +2 -2
- data/vendor/assets/javascripts/materialize/chips.js +40 -11
- data/vendor/assets/javascripts/materialize/dropdown.js +12 -12
- data/vendor/assets/javascripts/materialize/forms.js +131 -35
- data/vendor/assets/javascripts/materialize/global.js +55 -0
- data/vendor/assets/javascripts/materialize/init.js +40 -3
- data/vendor/assets/javascripts/materialize/materialbox.js +93 -77
- data/vendor/assets/javascripts/materialize/modal.js +12 -12
- data/vendor/assets/javascripts/materialize/parallax.js +48 -48
- data/vendor/assets/javascripts/materialize/scrollFire.js +40 -37
- data/vendor/assets/javascripts/materialize/scrollspy.js +2 -53
- data/vendor/assets/javascripts/materialize/sideNav.js +46 -40
- data/vendor/assets/javascripts/materialize/slider.js +15 -12
- data/vendor/assets/javascripts/materialize/tabs.js +104 -35
- data/vendor/assets/javascripts/materialize/toasts.js +122 -123
- data/vendor/assets/javascripts/materialize/tooltip.js +15 -13
- data/vendor/assets/javascripts/materialize/transitions.js +24 -24
- data/vendor/assets/stylesheets/materialize/_badges.scss +46 -0
- data/vendor/assets/stylesheets/materialize/_buttons.scss +29 -17
- data/vendor/assets/stylesheets/materialize/_cards.scss +9 -3
- data/vendor/assets/stylesheets/materialize/_carousel.scss +1 -1
- data/vendor/assets/stylesheets/materialize/_collapsible.scss +3 -7
- data/vendor/assets/stylesheets/materialize/_global.scss +5 -61
- data/vendor/assets/stylesheets/materialize/_materialbox.scss +13 -12
- data/vendor/assets/stylesheets/materialize/_navbar.scss +26 -7
- data/vendor/assets/stylesheets/materialize/_sideNav.scss +5 -5
- data/vendor/assets/stylesheets/materialize/_table_of_contents.scss +2 -2
- data/vendor/assets/stylesheets/materialize/_toast.scss +1 -1
- data/vendor/assets/stylesheets/materialize/_tooltip.scss +2 -3
- data/vendor/assets/stylesheets/materialize/_transitions.scss +13 -0
- data/vendor/assets/stylesheets/materialize/_variables.scss +7 -1
- data/vendor/assets/stylesheets/materialize/_waves.scss +80 -143
- data/vendor/assets/stylesheets/materialize/forms/_input-fields.scss +4 -4
- metadata +9 -4
@@ -5,11 +5,13 @@
|
|
5
5
|
Materialize.updateTextFields = function() {
|
6
6
|
var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea';
|
7
7
|
$(input_selector).each(function(index, element) {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
else {
|
12
|
-
$
|
8
|
+
var $this = $(this);
|
9
|
+
if ($(element).val().length > 0 || element.autofocus || $this.attr('placeholder') !== undefined) {
|
10
|
+
$this.siblings('label').addClass('active');
|
11
|
+
} else if ($(element)[0].validity) {
|
12
|
+
$this.siblings('label').toggleClass('active', $(element)[0].validity.badInput === true);
|
13
|
+
} else {
|
14
|
+
$this.siblings('label').removeClass('active');
|
13
15
|
}
|
14
16
|
});
|
15
17
|
};
|
@@ -68,8 +70,8 @@
|
|
68
70
|
});
|
69
71
|
|
70
72
|
window.validate_field = function(object) {
|
71
|
-
var hasLength = object.attr('length') !== undefined;
|
72
|
-
var lenAttr = parseInt(object.attr('length'));
|
73
|
+
var hasLength = object.attr('data-length') !== undefined;
|
74
|
+
var lenAttr = parseInt(object.attr('data-length'));
|
73
75
|
var len = object.val().length;
|
74
76
|
|
75
77
|
if (object.val().length === 0 && object[0].validity.badInput === false) {
|
@@ -281,7 +283,9 @@
|
|
281
283
|
$.fn.autocomplete = function (options) {
|
282
284
|
// Defaults
|
283
285
|
var defaults = {
|
284
|
-
data: {}
|
286
|
+
data: {},
|
287
|
+
limit: Infinity,
|
288
|
+
onAutocomplete: null
|
285
289
|
};
|
286
290
|
|
287
291
|
options = $.extend(defaults, options);
|
@@ -289,20 +293,34 @@
|
|
289
293
|
return this.each(function() {
|
290
294
|
var $input = $(this);
|
291
295
|
var data = options.data,
|
296
|
+
count = 0,
|
297
|
+
activeIndex = 0,
|
298
|
+
oldVal,
|
292
299
|
$inputDiv = $input.closest('.input-field'); // Div to append on
|
293
300
|
|
294
301
|
// Check if data isn't empty
|
295
302
|
if (!$.isEmptyObject(data)) {
|
296
|
-
// Create autocomplete element
|
297
303
|
var $autocomplete = $('<ul class="autocomplete-content dropdown-content"></ul>');
|
304
|
+
var $oldAutocomplete;
|
298
305
|
|
299
|
-
// Append autocomplete element
|
306
|
+
// Append autocomplete element.
|
307
|
+
// Prevent double structure init.
|
300
308
|
if ($inputDiv.length) {
|
301
|
-
$inputDiv.
|
309
|
+
$oldAutocomplete = $inputDiv.children('.autocomplete-content.dropdown-content').first();
|
310
|
+
if (!$oldAutocomplete.length) {
|
311
|
+
$inputDiv.append($autocomplete); // Set ul in body
|
312
|
+
}
|
302
313
|
} else {
|
303
|
-
$input.
|
314
|
+
$oldAutocomplete = $input.next('.autocomplete-content.dropdown-content');
|
315
|
+
if (!$oldAutocomplete.length) {
|
316
|
+
$input.after($autocomplete);
|
317
|
+
}
|
318
|
+
}
|
319
|
+
if ($oldAutocomplete.length) {
|
320
|
+
$autocomplete = $oldAutocomplete;
|
304
321
|
}
|
305
322
|
|
323
|
+
// Highlight partial match.
|
306
324
|
var highlight = function(string, $el) {
|
307
325
|
var img = $el.find('img');
|
308
326
|
var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + ""),
|
@@ -316,42 +334,109 @@
|
|
316
334
|
}
|
317
335
|
};
|
318
336
|
|
337
|
+
// Reset current element position
|
338
|
+
var resetCurrentElement = function() {
|
339
|
+
activeIndex = 0;
|
340
|
+
$autocomplete.find('.active').removeClass('active');
|
341
|
+
}
|
342
|
+
|
319
343
|
// Perform search
|
320
|
-
$input.on('keyup', function (e) {
|
321
|
-
//
|
322
|
-
|
323
|
-
|
344
|
+
$input.off('keyup.autocomplete').on('keyup.autocomplete', function (e) {
|
345
|
+
// Reset count.
|
346
|
+
count = 0;
|
347
|
+
|
348
|
+
// Don't capture enter or arrow key usage.
|
349
|
+
if (e.which === 13 ||
|
350
|
+
e.which === 38 ||
|
351
|
+
e.which === 40) {
|
324
352
|
return;
|
325
353
|
}
|
326
354
|
|
327
355
|
var val = $input.val().toLowerCase();
|
328
|
-
$autocomplete.empty();
|
329
356
|
|
330
357
|
// Check if the input isn't empty
|
331
|
-
if (
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
if(
|
338
|
-
|
339
|
-
|
340
|
-
|
358
|
+
if (oldVal !== val) {
|
359
|
+
$autocomplete.empty();
|
360
|
+
resetCurrentElement();
|
361
|
+
|
362
|
+
if (val !== '') {
|
363
|
+
for(var key in data) {
|
364
|
+
if (data.hasOwnProperty(key) &&
|
365
|
+
key.toLowerCase().indexOf(val) !== -1 &&
|
366
|
+
key.toLowerCase() !== val) {
|
367
|
+
// Break if past limit
|
368
|
+
if (count >= options.limit) {
|
369
|
+
break;
|
370
|
+
}
|
371
|
+
|
372
|
+
var autocompleteOption = $('<li></li>');
|
373
|
+
if (!!data[key]) {
|
374
|
+
autocompleteOption.append('<img src="'+ data[key] +'" class="right circle"><span>'+ key +'</span>');
|
375
|
+
} else {
|
376
|
+
autocompleteOption.append('<span>'+ key +'</span>');
|
377
|
+
}
|
378
|
+
|
379
|
+
$autocomplete.append(autocompleteOption);
|
380
|
+
highlight(val, autocompleteOption);
|
381
|
+
count++;
|
341
382
|
}
|
342
|
-
$autocomplete.append(autocompleteOption);
|
343
|
-
|
344
|
-
highlight(val, autocompleteOption);
|
345
383
|
}
|
346
384
|
}
|
347
385
|
}
|
386
|
+
|
387
|
+
// Update oldVal
|
388
|
+
oldVal = val;
|
389
|
+
});
|
390
|
+
|
391
|
+
$input.off('keydown.autocomplete').on('keydown.autocomplete', function (e) {
|
392
|
+
// Arrow keys and enter key usage
|
393
|
+
var keyCode = e.which,
|
394
|
+
liElement,
|
395
|
+
numItems = $autocomplete.children('li').length,
|
396
|
+
$active = $autocomplete.children('.active').first();
|
397
|
+
|
398
|
+
// select element on Enter
|
399
|
+
if (keyCode === 13) {
|
400
|
+
liElement = $autocomplete.children('li').eq(activeIndex);
|
401
|
+
if (liElement.length) {
|
402
|
+
liElement.click();
|
403
|
+
e.preventDefault();
|
404
|
+
}
|
405
|
+
return;
|
406
|
+
}
|
407
|
+
|
408
|
+
// Capture up and down key
|
409
|
+
if ( keyCode === 38 || keyCode === 40 ) {
|
410
|
+
e.preventDefault();
|
411
|
+
|
412
|
+
if (keyCode === 38 &&
|
413
|
+
activeIndex > 0) {
|
414
|
+
activeIndex--;
|
415
|
+
}
|
416
|
+
|
417
|
+
if (keyCode === 40 &&
|
418
|
+
activeIndex < (numItems - 1) &&
|
419
|
+
$active.length) {
|
420
|
+
activeIndex++;
|
421
|
+
}
|
422
|
+
|
423
|
+
$active.removeClass('active');
|
424
|
+
$autocomplete.children('li').eq(activeIndex).addClass('active');
|
425
|
+
}
|
348
426
|
});
|
349
427
|
|
350
428
|
// Set input value
|
351
429
|
$autocomplete.on('click', 'li', function () {
|
352
|
-
$
|
430
|
+
var text = $(this).text().trim();
|
431
|
+
$input.val(text);
|
353
432
|
$input.trigger('change');
|
354
433
|
$autocomplete.empty();
|
434
|
+
resetCurrentElement();
|
435
|
+
|
436
|
+
// Handle onAutocomplete callback.
|
437
|
+
if (typeof(options.onAutocomplete) === "function") {
|
438
|
+
options.onAutocomplete.call(this, text);
|
439
|
+
}
|
355
440
|
});
|
356
441
|
}
|
357
442
|
});
|
@@ -514,10 +599,14 @@
|
|
514
599
|
if (!options.is(':visible')) {
|
515
600
|
$(this).trigger('open', ['focus']);
|
516
601
|
var label = $(this).val();
|
602
|
+
if (multiple && label.indexOf(',') >= 0) {
|
603
|
+
label = label.split(',')[0];
|
604
|
+
}
|
605
|
+
|
517
606
|
var selectedOption = options.find('li').filter(function() {
|
518
607
|
return $(this).text().toLowerCase() === label.toLowerCase();
|
519
608
|
})[0];
|
520
|
-
activateOption(options, selectedOption);
|
609
|
+
activateOption(options, selectedOption, true);
|
521
610
|
}
|
522
611
|
},
|
523
612
|
'click': function (e){
|
@@ -554,13 +643,20 @@
|
|
554
643
|
});
|
555
644
|
}
|
556
645
|
|
557
|
-
|
558
|
-
|
646
|
+
/**
|
647
|
+
* Make option as selected and scroll to selected position
|
648
|
+
* @param {jQuery} collection Select options jQuery element
|
649
|
+
* @param {Element} newOption element of the new option
|
650
|
+
* @param {Boolean} firstActivation If on first activation of select
|
651
|
+
*/
|
652
|
+
var activateOption = function(collection, newOption, firstActivation) {
|
559
653
|
if (newOption) {
|
560
654
|
collection.find('li.selected').removeClass('selected');
|
561
655
|
var option = $(newOption);
|
562
656
|
option.addClass('selected');
|
563
|
-
|
657
|
+
if (!multiple || !!firstActivation) {
|
658
|
+
options.scrollTo(option);
|
659
|
+
}
|
564
660
|
}
|
565
661
|
};
|
566
662
|
|
@@ -86,6 +86,61 @@ Materialize.elementOrParentIsFixed = function(element) {
|
|
86
86
|
return isFixed;
|
87
87
|
};
|
88
88
|
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Get time in ms
|
92
|
+
* @license https://raw.github.com/jashkenas/underscore/master/LICENSE
|
93
|
+
* @type {function}
|
94
|
+
* @return {number}
|
95
|
+
*/
|
96
|
+
var getTime = (Date.now || function () {
|
97
|
+
return new Date().getTime();
|
98
|
+
});
|
99
|
+
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Returns a function, that, when invoked, will only be triggered at most once
|
103
|
+
* during a given window of time. Normally, the throttled function will run
|
104
|
+
* as much as it can, without ever going more than once per `wait` duration;
|
105
|
+
* but if you'd like to disable the execution on the leading edge, pass
|
106
|
+
* `{leading: false}`. To disable execution on the trailing edge, ditto.
|
107
|
+
* @license https://raw.github.com/jashkenas/underscore/master/LICENSE
|
108
|
+
* @param {function} func
|
109
|
+
* @param {number} wait
|
110
|
+
* @param {Object=} options
|
111
|
+
* @returns {Function}
|
112
|
+
*/
|
113
|
+
Materialize.throttle = function(func, wait, options) {
|
114
|
+
var context, args, result;
|
115
|
+
var timeout = null;
|
116
|
+
var previous = 0;
|
117
|
+
options || (options = {});
|
118
|
+
var later = function () {
|
119
|
+
previous = options.leading === false ? 0 : getTime();
|
120
|
+
timeout = null;
|
121
|
+
result = func.apply(context, args);
|
122
|
+
context = args = null;
|
123
|
+
};
|
124
|
+
return function () {
|
125
|
+
var now = getTime();
|
126
|
+
if (!previous && options.leading === false) previous = now;
|
127
|
+
var remaining = wait - (now - previous);
|
128
|
+
context = this;
|
129
|
+
args = arguments;
|
130
|
+
if (remaining <= 0) {
|
131
|
+
clearTimeout(timeout);
|
132
|
+
timeout = null;
|
133
|
+
previous = now;
|
134
|
+
result = func.apply(context, args);
|
135
|
+
context = args = null;
|
136
|
+
} else if (!timeout && options.trailing !== false) {
|
137
|
+
timeout = setTimeout(later, remaining);
|
138
|
+
}
|
139
|
+
return result;
|
140
|
+
};
|
141
|
+
};
|
142
|
+
|
143
|
+
|
89
144
|
// Velocity has conflicts when loaded with jQuery, this will check for it
|
90
145
|
// First, check if in noConflict mode
|
91
146
|
var Vel;
|
@@ -78,6 +78,12 @@
|
|
78
78
|
checkForChanges();
|
79
79
|
|
80
80
|
|
81
|
+
// BuySellAds Demos close button.
|
82
|
+
$('.buysellads.buysellads-demo .close').on('click', function() {
|
83
|
+
$(this).parent().remove();
|
84
|
+
});
|
85
|
+
|
86
|
+
|
81
87
|
// Github Latest Commit
|
82
88
|
if ($('.github-commit').length) { // Checks if widget div exists (Index only)
|
83
89
|
$.ajax({
|
@@ -137,8 +143,33 @@
|
|
137
143
|
indeterminateCheckbox.indeterminate = true;
|
138
144
|
|
139
145
|
|
146
|
+
// Pushpin Demo Init
|
147
|
+
if ($('.pushpin-demo-nav').length) {
|
148
|
+
$('.pushpin-demo-nav').each(function() {
|
149
|
+
var $this = $(this);
|
150
|
+
var $target = $('#' + $(this).attr('data-target'));
|
151
|
+
$this.pushpin({
|
152
|
+
top: $target.offset().top,
|
153
|
+
bottom: $target.offset().top + $target.outerHeight() - $this.height()
|
154
|
+
});
|
155
|
+
});
|
156
|
+
}
|
157
|
+
|
158
|
+
// CSS Transitions Demo Init
|
159
|
+
if ($('#scale-demo').length &&
|
160
|
+
$('#scale-demo-trigger').length) {
|
161
|
+
$('#scale-demo-trigger').click(function() {
|
162
|
+
$('#scale-demo').toggleClass('scale-out');
|
163
|
+
});
|
164
|
+
}
|
165
|
+
|
166
|
+
// Swipeable Tabs Demo Init
|
167
|
+
if ($('#tabs-swipe-demo').length) {
|
168
|
+
$('#tabs-swipe-demo').tabs({ 'swipeable': true });
|
169
|
+
}
|
170
|
+
|
140
171
|
// Plugin initialization
|
141
|
-
$('.carousel.carousel-slider').carousel({
|
172
|
+
$('.carousel.carousel-slider').carousel({fullWidth: true});
|
142
173
|
$('.carousel').carousel();
|
143
174
|
$('.slider').slider({full_width: true});
|
144
175
|
$('.parallax').parallax();
|
@@ -151,8 +182,8 @@
|
|
151
182
|
data: {"Apple": null, "Microsoft": null, "Google": 'http://placehold.it/250x250'}
|
152
183
|
});
|
153
184
|
|
185
|
+
// Chips
|
154
186
|
$('.chips').material_chip();
|
155
|
-
|
156
187
|
$('.chips-initial').material_chip({
|
157
188
|
readOnly: true,
|
158
189
|
data: [{
|
@@ -163,11 +194,17 @@
|
|
163
194
|
tag: 'Google',
|
164
195
|
}]
|
165
196
|
});
|
166
|
-
|
167
197
|
$('.chips-placeholder').material_chip({
|
168
198
|
placeholder: 'Enter a tag',
|
169
199
|
secondaryPlaceholder: '+Tag',
|
170
200
|
});
|
201
|
+
$('.chips-autocomplete').material_chip({
|
202
|
+
autocompleteData: {
|
203
|
+
'Apple': null,
|
204
|
+
'Microsoft': null,
|
205
|
+
'Google': null
|
206
|
+
}
|
207
|
+
});
|
171
208
|
|
172
209
|
|
173
210
|
}); // end of document ready
|
@@ -75,7 +75,11 @@
|
|
75
75
|
}
|
76
76
|
|
77
77
|
// Set css on origin
|
78
|
-
origin.css({
|
78
|
+
origin.css({
|
79
|
+
position: 'absolute',
|
80
|
+
'z-index': 1000,
|
81
|
+
'will-change': 'left, top, width, height'
|
82
|
+
})
|
79
83
|
.data('width', originalWidth)
|
80
84
|
.data('height', originalHeight);
|
81
85
|
|
@@ -88,10 +92,21 @@
|
|
88
92
|
if (doneAnimating === true)
|
89
93
|
returnToOriginal();
|
90
94
|
});
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
+
|
96
|
+
// Put before in origin image to preserve z-index layering.
|
97
|
+
origin.before(overlay);
|
98
|
+
|
99
|
+
// Set dimensions if needed
|
100
|
+
var overlayOffset = overlay[0].getBoundingClientRect();
|
101
|
+
overlay.css({
|
102
|
+
width: windowWidth,
|
103
|
+
height: windowHeight,
|
104
|
+
left: -1 * overlayOffset.left,
|
105
|
+
top: -1 * overlayOffset.top
|
106
|
+
})
|
107
|
+
|
108
|
+
// Animate Overlay
|
109
|
+
overlay.velocity({opacity: 1},
|
95
110
|
{duration: inDuration, queue: false, easing: 'easeOutQuad'} );
|
96
111
|
|
97
112
|
// Add and animate caption if it exists
|
@@ -162,7 +177,7 @@
|
|
162
177
|
); // End Velocity
|
163
178
|
}
|
164
179
|
|
165
|
-
|
180
|
+
}); // End origin on click
|
166
181
|
|
167
182
|
|
168
183
|
// Return on scroll
|
@@ -186,84 +201,85 @@
|
|
186
201
|
// This function returns the modaled image to the original spot
|
187
202
|
function returnToOriginal() {
|
188
203
|
|
189
|
-
|
190
|
-
|
191
|
-
var placeholder = origin.parent('.material-placeholder');
|
192
|
-
var windowWidth = window.innerWidth;
|
193
|
-
var windowHeight = window.innerHeight;
|
194
|
-
var originalWidth = origin.data('width');
|
195
|
-
var originalHeight = origin.data('height');
|
204
|
+
doneAnimating = false;
|
196
205
|
|
197
|
-
|
198
|
-
|
199
|
-
|
206
|
+
var placeholder = origin.parent('.material-placeholder');
|
207
|
+
var windowWidth = window.innerWidth;
|
208
|
+
var windowHeight = window.innerHeight;
|
209
|
+
var originalWidth = origin.data('width');
|
210
|
+
var originalHeight = origin.data('height');
|
200
211
|
|
212
|
+
origin.velocity("stop", true);
|
213
|
+
$('#materialbox-overlay').velocity("stop", true);
|
214
|
+
$('.materialbox-caption').velocity("stop", true);
|
201
215
|
|
202
|
-
$('#materialbox-overlay').velocity({opacity: 0}, {
|
203
|
-
duration: outDuration, // Delay prevents animation overlapping
|
204
|
-
queue: false, easing: 'easeOutQuad',
|
205
|
-
complete: function(){
|
206
|
-
// Remove Overlay
|
207
|
-
overlayActive = false;
|
208
|
-
$(this).remove();
|
209
|
-
}
|
210
|
-
});
|
211
216
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
duration: outDuration,
|
222
|
-
queue: false, easing: 'easeOutQuad'
|
223
|
-
}
|
224
|
-
);
|
217
|
+
$('#materialbox-overlay').velocity({opacity: 0}, {
|
218
|
+
duration: outDuration, // Delay prevents animation overlapping
|
219
|
+
queue: false, easing: 'easeOutQuad',
|
220
|
+
complete: function(){
|
221
|
+
// Remove Overlay
|
222
|
+
overlayActive = false;
|
223
|
+
$(this).remove();
|
224
|
+
}
|
225
|
+
});
|
225
226
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
227
|
+
// Resize Image
|
228
|
+
origin.velocity(
|
229
|
+
{
|
230
|
+
width: originalWidth,
|
231
|
+
height: originalHeight,
|
232
|
+
left: 0,
|
233
|
+
top: 0
|
234
|
+
},
|
235
|
+
{
|
236
|
+
duration: outDuration,
|
237
|
+
queue: false, easing: 'easeOutQuad'
|
238
|
+
}
|
239
|
+
);
|
240
|
+
|
241
|
+
// Remove Caption + reset css settings on image
|
242
|
+
$('.materialbox-caption').velocity({opacity: 0}, {
|
243
|
+
duration: outDuration, // Delay prevents animation overlapping
|
244
|
+
queue: false, easing: 'easeOutQuad',
|
245
|
+
complete: function(){
|
246
|
+
placeholder.css({
|
247
|
+
height: '',
|
248
|
+
width: '',
|
249
|
+
position: '',
|
250
|
+
top: '',
|
251
|
+
left: ''
|
252
|
+
});
|
253
|
+
|
254
|
+
origin.css({
|
255
|
+
height: '',
|
256
|
+
top: '',
|
257
|
+
left: '',
|
258
|
+
width: '',
|
259
|
+
'max-width': '',
|
260
|
+
position: '',
|
261
|
+
'z-index': '',
|
262
|
+
'will-change': ''
|
263
|
+
});
|
264
|
+
|
265
|
+
// Remove class
|
266
|
+
origin.removeClass('active');
|
267
|
+
doneAnimating = true;
|
268
|
+
$(this).remove();
|
269
|
+
|
270
|
+
// Remove overflow overrides on ancestors
|
271
|
+
if (ancestorsChanged) {
|
272
|
+
ancestorsChanged.css('overflow', '');
|
258
273
|
}
|
259
|
-
}
|
260
|
-
|
261
|
-
}
|
274
|
+
}
|
262
275
|
});
|
263
|
-
};
|
264
276
|
|
265
|
-
|
266
|
-
|
267
|
-
}
|
277
|
+
}
|
278
|
+
});
|
279
|
+
};
|
280
|
+
|
281
|
+
$(document).ready(function(){
|
282
|
+
$('.materialboxed').materialbox();
|
283
|
+
});
|
268
284
|
|
269
285
|
}( jQuery ));
|
@@ -10,13 +10,13 @@
|
|
10
10
|
init : function(options) {
|
11
11
|
var defaults = {
|
12
12
|
opacity: 0.5,
|
13
|
-
|
14
|
-
|
13
|
+
inDuration: 350,
|
14
|
+
outDuration: 250,
|
15
15
|
ready: undefined,
|
16
16
|
complete: undefined,
|
17
17
|
dismissible: true,
|
18
|
-
|
19
|
-
|
18
|
+
startingTop: '4%',
|
19
|
+
endingTop: '10%'
|
20
20
|
};
|
21
21
|
|
22
22
|
// Override defaults
|
@@ -40,12 +40,12 @@
|
|
40
40
|
$modal.find('.modal-close').off('click.close');
|
41
41
|
$(document).off('keyup.modal' + overlayID);
|
42
42
|
|
43
|
-
$overlay.velocity( { opacity: 0}, {duration: options.
|
43
|
+
$overlay.velocity( { opacity: 0}, {duration: options.outDuration, queue: false, ease: "easeOutQuart"});
|
44
44
|
|
45
45
|
|
46
46
|
// Define Bottom Sheet animation
|
47
47
|
var exitVelocityOptions = {
|
48
|
-
duration: options.
|
48
|
+
duration: options.outDuration,
|
49
49
|
queue: false,
|
50
50
|
ease: "easeOutCubic",
|
51
51
|
// Handle modal ready callback
|
@@ -65,7 +65,7 @@
|
|
65
65
|
}
|
66
66
|
else {
|
67
67
|
$modal.velocity(
|
68
|
-
{ top: options.
|
68
|
+
{ top: options.startingTop, opacity: 0, scaleX: 0.7},
|
69
69
|
exitVelocityOptions
|
70
70
|
);
|
71
71
|
}
|
@@ -115,12 +115,12 @@
|
|
115
115
|
opacity: 0
|
116
116
|
});
|
117
117
|
|
118
|
-
$overlay.velocity({opacity: options.opacity}, {duration: options.
|
118
|
+
$overlay.velocity({opacity: options.opacity}, {duration: options.inDuration, queue: false, ease: "easeOutCubic"});
|
119
119
|
$modal.data('associated-overlay', $overlay[0]);
|
120
120
|
|
121
121
|
// Define Bottom Sheet animation
|
122
122
|
var enterVelocityOptions = {
|
123
|
-
duration: options.
|
123
|
+
duration: options.inDuration,
|
124
124
|
queue: false,
|
125
125
|
ease: "easeOutCubic",
|
126
126
|
// Handle modal ready callback
|
@@ -135,8 +135,8 @@
|
|
135
135
|
}
|
136
136
|
else {
|
137
137
|
$.Velocity.hook($modal, "scaleX", 0.7);
|
138
|
-
$modal.css({ top: options.
|
139
|
-
$modal.velocity({top: options.
|
138
|
+
$modal.css({ top: options.startingTop });
|
139
|
+
$modal.velocity({top: options.endingTop, opacity: 1, scaleX: '1'}, enterVelocityOptions);
|
140
140
|
}
|
141
141
|
|
142
142
|
};
|
@@ -148,7 +148,7 @@
|
|
148
148
|
|
149
149
|
// Close Handlers
|
150
150
|
$(document).on('click.modalTrigger', 'a[href="#' + modal_id + '"], [data-target="' + modal_id + '"]', function(e) {
|
151
|
-
options.
|
151
|
+
options.startingTop = ($(this).offset().top - $(window).scrollTop()) /1.15;
|
152
152
|
openModal($(this));
|
153
153
|
e.preventDefault();
|
154
154
|
}); // done set on click
|