mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 08:53:38 +08:00
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:
parent
3dfa22b55a
commit
298f18cf70
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user