app/assets/javascripts/materialize/materialbox.js in materialize-sass-0.96.1 vs app/assets/javascripts/materialize/materialbox.js in materialize-sass-0.96.2
- old
+ new
@@ -2,46 +2,46 @@
$.fn.materialbox = function () {
return this.each(function() {
- if ($(this).hasClass('intialized')) {
+ if ($(this).hasClass('initialized')) {
return;
}
- $(this).addClass('intialized');
+ $(this).addClass('initialized');
var overlayActive = false;
var doneAnimating = true;
var inDuration = 275;
var outDuration = 200;
var origin = $(this);
var placeholder = $('<div></div>').addClass('material-placeholder');
var originalWidth = 0;
var originalHeight = 0;
origin.wrap(placeholder);
-
-
+
+
origin.on('click', function(){
var placeholder = origin.parent('.material-placeholder');
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
var originalWidth = origin.width();
var originalHeight = origin.height();
-
+
// If already modal, return to original
if (doneAnimating === false) {
returnToOriginal();
return false;
}
else if (overlayActive && doneAnimating===true) {
returnToOriginal();
return false;
}
-
+
// Set states
doneAnimating = false;
origin.addClass('active');
overlayActive = true;
@@ -52,13 +52,13 @@
height: placeholder[0].getBoundingClientRect().height,
position: 'relative',
top: 0,
left: 0
});
-
-
+
+
// Set css on origin
origin.css({position: 'absolute', 'z-index': 1000})
.data('width', originalWidth)
.data('height', originalHeight);
@@ -81,11 +81,11 @@
if (origin.data('caption') !== "") {
var $photo_caption = $('<div class="materialbox-caption"></div>');
$photo_caption.text(origin.data('caption'));
$('body').append($photo_caption);
$photo_caption.css({ "display": "inline" });
- $photo_caption.velocity({opacity: 1}, {duration: inDuration, queue: false, easing: 'easeOutQuad'})
+ $photo_caption.velocity({opacity: 1}, {duration: inDuration, queue: false, easing: 'easeOutQuad'});
}
// Resize Image
@@ -176,10 +176,10 @@
var placeholder = origin.parent('.material-placeholder');
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
var originalWidth = origin.data('width');
var originalHeight = origin.data('height');
-
+
origin.velocity("stop", true);
$('#materialbox-overlay').velocity("stop", true);
$('.materialbox-caption').velocity("stop", true);