2015-02-23 16:50:51 +01:00
diff --git a/css/mediaboxBlack.css b/css/mediaboxBlack.css
2015-06-10 16:56:28 +02:00
index 9213688..752c704 100644
2015-02-23 16:50:51 +01:00
--- a/css/mediaboxBlack.css
+++ b/css/mediaboxBlack.css
2015-06-10 16:56:28 +02:00
@@ -38,9 +38,21 @@
-khtml-box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
-moz-box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
+ width: 100%;
+ height: 100%;
2015-02-23 16:50:51 +01:00
}
#mbCenter img{
2015-06-10 16:56:28 +02:00
+ width:auto;
+ height:auto;
+ max-width:100%;
+ max-height:95%;
2015-02-23 16:50:51 +01:00
border-radius: 4px;
2015-06-10 16:56:28 +02:00
+ image-orientation: from-image;
+ position: absolute;
+ margin: auto;
+ top: 0;
+ left: 0;
+ right: 0;
2015-02-23 16:50:51 +01:00
}
#mbCenter.mbLoading {
diff --git a/css/mediaboxWhite.css b/css/mediaboxWhite.css
2015-06-10 16:56:28 +02:00
index de9d439..832911e 100644
2015-02-23 16:50:51 +01:00
--- a/css/mediaboxWhite.css
+++ b/css/mediaboxWhite.css
2015-06-10 16:56:28 +02:00
@@ -38,10 +38,22 @@
-khtml-box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
-moz-box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
+ width: 100%;
+ height: 100%;
}
2015-02-23 16:50:51 +01:00
#mbCenter img{
2015-06-10 16:56:28 +02:00
+ width:auto;
+ height:auto;
+ max-width:100%;
+ max-height:95%;
2015-02-23 16:50:51 +01:00
border-radius: 4px;
2015-06-10 16:56:28 +02:00
+ image-orientation: from-image;
2015-02-23 16:50:51 +01:00
+ position: absolute;
+ margin: auto;
+ top: 0;
+ left: 0;
+ right: 0;
}
#mbCenter.mbLoading {
diff --git a/js/mediabox1.5.4.js b/js/mediabox1.5.4.js
2015-06-10 16:56:28 +02:00
index 821e599..e47a138 100644
2015-02-23 16:50:51 +01:00
--- a/js/mediabox1.5.4.js
+++ b/js/mediabox1.5.4.js
@@ -815,6 +815,16 @@ var Mediabox;
if (mediaType == "img"){
mediaWidth = preload.width;
mediaHeight = preload.height;
+
+ // Hack jn@hz6.de: make lightbox squared to make room for the image (that will be properly rotated by the browser [at least FF since v26])
2015-06-10 16:56:28 +02:00
+ if (mediaWidth > mediaHeight) {
2015-02-23 16:50:51 +01:00
+ mediaHeight = mediaWidth
+ }
+
+ if (mediaWidth < mediaHeight) {
+ mediaWidth = mediaHeight
+ }
+
if (options.imgBackground) {
media.setStyles({backgroundImage: "url("+URL+")", display: ""});
} else { // Thanks to Dusan Medlin for fixing large 16x9 image errors in a 4x3 browser
2015-06-10 16:56:28 +02:00
@@ -827,11 +837,14 @@ var Mediabox;
mediaHeight = preload.height = parseInt((mediaWidth/preload.width)*mediaHeight, 10);
preload.width = mediaWidth;
2015-02-23 16:50:51 +01:00
}
2015-06-10 16:56:28 +02:00
+
2015-02-23 16:50:51 +01:00
if (Browser.ie) preload = document.id(preload);
if (options.clickBlock) preload.addEvent('mousedown', function(e){ e.stop(); }).addEvent('contextmenu', function(e){ e.stop(); });
+
2015-06-10 16:56:28 +02:00
media.setStyles({backgroundImage: "none", display: ""});
2015-02-23 16:50:51 +01:00
preload.inject(media);
}
2015-06-10 16:56:28 +02:00
+
2015-02-23 16:50:51 +01:00
// mediaWidth += "px";
2015-06-10 16:56:28 +02:00
// mediaHeight += "px";
} else if (mediaType == "inline") {
@@ -973,4 +986,4 @@ Mediabox.scanPage = function() {
2015-02-23 16:50:51 +01:00
});
};
-window.addEvents({domready: Mediabox.scanPage, resize: Mediabox.recenter}); // to recenter the overlay while scrolling, add "scroll: Mediabox.recenter" to the object
\ No newline at end of file
+window.addEvents({domready: Mediabox.scanPage, resize: Mediabox.recenter}); // to recenter the overlay while scrolling, add "scroll: Mediabox.recenter" to the object