UX: Enabled pinch to zoom for lightbox (#7161)

* UX: Enabled pinch to zoom for lightbox

* FIX: Prettier for lightbox.js

* FIX: Only change content of meta tag
This commit is contained in:
Tim Lange 2019-03-18 15:57:24 +01:00 committed by Robin Ward
parent 3dfa22b55a
commit 298f18cf70

View File

@ -6,6 +6,7 @@ export default function($elem) {
if (!$elem) {
return;
}
const originalMeta = $("meta[name=viewport]").attr("content");
loadScript("/javascripts/jquery.magnific-popup.min.js").then(function() {
const spoilers = $elem.find(".spoiler a.lightbox, .spoiled a.lightbox");
$elem
@ -23,6 +24,10 @@ export default function($elem) {
callbacks: {
open() {
$("meta[name=viewport]").attr(
"content",
"width=device-width, initial-scale=1.0"
);
const wrap = this.wrap,
img = this.currItem.img,
maxHeight = img.css("max-height");
@ -36,6 +41,7 @@ export default function($elem) {
});
},
beforeClose() {
$("meta[name=viewport]").attr("content", originalMeta);
this.wrap.off("click.pinhandler");
this.wrap.removeClass("mfp-force-scrollbars");
}