vendor/assets/javascripts/uikit/components/lightbox.js in uikit2-rails-0.1.8 vs vendor/assets/javascripts/uikit/components/lightbox.js in uikit2-rails-0.1.9
- old
+ new
@@ -1,6 +1,6 @@
-/*! UIkit 2.26.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+/*! UIkit 2.26.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(addon) {
var component;
if (window.UIkit) {
@@ -508,11 +508,11 @@
}
});
}
});
-
+
function getModal(lightbox) {
if (modal) {
modal.lightbox = lightbox;
return modal;
@@ -546,12 +546,20 @@
// destroy content on modal hide
modal.on("hide.uk.modal", function(e) {
modal.content.html('');
});
+ var resizeCache = {w: window.innerWidth, h:window.innerHeight};
+
UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(e){
- if (modal.is(':visible') && !UI.Utils.isFullscreen()) modal.lightbox.fitSize();
- }.bind(this), 100));
+
+ if (resizeCache.w !== window.innerWidth && modal.is(':visible') && !UI.Utils.isFullscreen()) {
+ modal.lightbox.fitSize();
+ }
+
+ resizeCache = {w: window.innerWidth, h:window.innerHeight};
+
+ }, 100));
modal.lightbox = lightbox;
return modal;
}