At last, I gave up the Magnifier Popup - zoom function, and replace it with css - zoom function.
The solution:
`var zoom_percent = "100";
function zoom(zoom_percent){
$(".mfp-figure figure").click(function(){
switch(zoom_percent){
case "100":
zoom_percent = "120";
break;
case "120":
zoom_percent = "150";
break;
case "150":
zoom_percent = "200";
$(".mfp-figure figure").css("cursor", "zoom-out");
break;
case "200":
zoom_percent = "100";
$(".mfp-figure figure").css("cursor", "zoom-in");
break;
}
$(this).css("zoom", zoom_percent+"%");
});
}
$('#img').magnificPopup({
delegate: 'a',
type: 'image',
callbacks: {
open: function() {
$(".mfp-figure figure").css("cursor", "zoom-in");
zoom(zoom_percent);
},
close: function() {
// Will fire when popup is closed
}
// e.t.c.
}
});`
Hope this helps someone who is also looking for it.
Answer from Po Wong on Stack OverflowGitHub
gist.github.com › thespacedoctor › b70ebe1c631f87bd85840f12957911d0
[Image Zoom Effect] Image zoom effect for Magnific Popup #image #zoom #ui · GitHub
[Image Zoom Effect] Image zoom effect for Magnific Popup #image #zoom #ui - Image zoom effect for Magnific Popup.markdown
How to zoom-in 120%, 150%, and 180% on an image?
Thank you for reading my post. I am using Magnific Popup - zoom function. I wanna know how to set the zoom in %, and how to have 3 different degrees of zooming-in by clicking on the popup image. ... More on stackoverflow.com
css - How to Zoom-In an Image Using Magnific Popup's open() Method - Stack Overflow
The following code is used to trigger a Magnific pop-up when a page loads. Unfortunately, nearly all of the documentation provided by Dmitry Semenov (the author) focuses on three other initializat... More on stackoverflow.com
Image zoom effect for Magnific Popup
Yeah, it looks great. But this way the client always needs to download the large image even when it never displays it full size. I don't think this is desirable behavior. More on reddit.com
magnific popup - Toggle verticalFit on an open image? - Stack Overflow
I need Magnific to open up the image with verticalFit = true to start. The image is portrait aspect and needs to fit within the viewport. But if the user clicks on the image, Magnific should turn More on stackoverflow.com
CodePen
codepen.io › dimsemenov › pen › ngRXwo
Image zoom effect for Magnific Popup
$('.without-caption').magnificPopup({ type: 'image', closeOnContentClick: true, closeBtnInside: false, mainClass: 'mfp-no-margins mfp-with-zoom', // class to remove default margin from left and right side image: { verticalFit: true }, zoom: { enabled: true, duration: 300 // don't foget to change the duration also in CSS } }); $('.with-caption').magnificPopup({ type: 'image', closeOnContentClick: true, closeBtnInside: false, mainClass: 'mfp-with-zoom mfp-img-mobile', image: { verticalFit: true, titleSrc: function(item) { return item.el.attr('title') + ' · <a class="image-source-link" href="'+item.el.attr('data-source')+'" target="_blank">image source</a>'; } }, zoom: { enabled: true } });
Top answer 1 of 2
6
At last, I gave up the Magnifier Popup - zoom function, and replace it with css - zoom function.
The solution:
`var zoom_percent = "100";
function zoom(zoom_percent){
$(".mfp-figure figure").click(function(){
switch(zoom_percent){
case "100":
zoom_percent = "120";
break;
case "120":
zoom_percent = "150";
break;
case "150":
zoom_percent = "200";
$(".mfp-figure figure").css("cursor", "zoom-out");
break;
case "200":
zoom_percent = "100";
$(".mfp-figure figure").css("cursor", "zoom-in");
break;
}
$(this).css("zoom", zoom_percent+"%");
});
}
$('#img').magnificPopup({
delegate: 'a',
type: 'image',
callbacks: {
open: function() {
$(".mfp-figure figure").css("cursor", "zoom-in");
zoom(zoom_percent);
},
close: function() {
// Will fire when popup is closed
}
// e.t.c.
}
});`
Hope this helps someone who is also looking for it.
2 of 2
1
You can use something like the below code. It is a simple example which you can modify according to your code.
$("img").click(function(){
var zoom = parseInt($(this).css("zoom"));
if(zoom==180){
$(this).css("zoom","100%");
}else{
$(this).css("zoom",zoom+20+"%");
}
});
Hope it helps.
CodePen
codepen.io › ysnoritnk › pen › wVyZpg
magnific-popup-Zoom effect
div { text-align: center; } .mfp-with-zoom .mfp-container, .mfp-with-zoom.mfp-bg { opacity: 0; -webkit-backface-visibility: hidden; /* ideally, transition speed should match zoom duration */ -webkit-transition: all 0.3s ease-out; -moz-transition: all 0.3s ease-out; -o-transition: all 0.3s ease-out; transition: all 0.3s ease-out; } .mfp-with-zoom.mfp-ready .mfp-container { opacity: 1; } .mfp-with-zoom.mfp-ready.mfp-bg { opacity: 0.8; } .mfp-with-zoom.mfp-removing .mfp-container, .mfp-with-zoom.mfp-removing.mfp-bg { opacity: 0; } ... $('.popup-link').magnificPopup({ type: 'image', mainClass: 'mfp-with-zoom', zoom: { enabled: true, duration: 300, easing: 'ease-in-out', } });
Dimsemenov
dimsemenov.com › plugins › magnific-popup
Magnific Popup: Responsive jQuery Lightbox Plugin
Three simple popups with different scaling settings. 1 — fits horizontally and vertically, 2 — only horizontally, 3 — no gaps, zoom animation, close icon in top-right corner. You may put any HTML content in each gallery item and mix content types. In this example lazy-loading of images is enabled for the next image based on move direction.
Stack Overflow
stackoverflow.com › questions › 41005358 › how-to-zoom-in-an-image-using-magnific-popups-open-method
css - How to Zoom-In an Image Using Magnific Popup's open() Method - Stack Overflow
December 6, 2016 - $.magnificPopup.open({... various key-value pairs ...}); My goal is to have the initial item of a gallery zoom in when a page opens.
Payalord
payalord.github.io › xZoom
xZoom | jQuery Zoom Gallery plugin
June 8, 2024 - Tap to open "fullscreen" zoom on your mobile and double tap after that to open image with Magnific Pop-Up.
Quilltez
quilltez.com › blog › drupal-popup-image-functionality-fields-and-inline-images
Drupal Popup Image Functionality for fields and inline images | Quilltez
June 4, 2017 - $(context).find('.ckeditor-magnific-popup').once('mfp-processed').each(function () { var mag = $(this).magnificPopup({ type: 'image', mainClass: 'mfp-with-zoom', // this class is for CSS animation below closeOnContentClick: true, callbacks: {}, zoom: { enabled: true, // By default it's false, so don't forget to enable it duration: 300, // duration of the effect, in milliseconds easing: 'ease-in-out', // CSS transition easing function // The "opener" function should return the element from which popup will be zoomed in // and to which popup will be scaled down // By defailt it looks for an image tag: opener: function (openerElement) { // openerElement is the element on which popup was initialized, in this case its <a> tag // you don't need to add "opener" option if this code matches your needs, it's defailt one.
Reddit
reddit.com › r/web_design › image zoom effect for magnific popup
r/web_design on Reddit: Image zoom effect for Magnific Popup
September 8, 2012 - I hate these with my whole fucking body, I don't want theses fucking zoom boxes. I hate every FUCKING site that uses these. God damnit op ... Please be more more polite and explain why do you find the lightbox effect confusing. There are at least 3 ways to open image in new tab (if you want to get to the image directly) - click on middle mouse button, click with control, right click + open image,
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 751
How to enable Pinch Zoom for the enlarged image on mobile devices · Issue #751 · dimsemenov/Magnific-Popup
Hello I'm using the Magnific Popup plugin on my website's galleries (http://www.aak.co.il/mies_portfolio/מטבח-זכוכית/) and my client insist on enabling the pinch-n-zoom ability from mobile devies. I was playling with the general viewport settings, but nothing helped, the enlarged popped up image ...
CodePen
codepen.io › dimsemenov › embed › ngRXwo
CodePen Embed - Image zoom effect for Magnific Popup
December 11, 2017 - $('.without-caption').magnificPopup({ type: 'image', closeOnContentClick: true, closeBtnInside: false, mainClass: 'mfp-no-margins mfp-with-zoom', // class to remove default margin from left and right side image: { verticalFit: true }, zoom: { enabled: true, duration: 300 // don't foget to change the duration also in CSS } }); $('.with-caption').magnificPopup({ type: 'image', closeOnContentClick: true, closeBtnInside: false, mainClass: 'mfp-with-zoom mfp-img-mobile', image: { verticalFit: true, titleSrc: function(item) { return item.el.attr('title') + ' · <a class="image-source-link" href="'+item.el.attr('data-source')+'" target="_blank">image source</a>'; } }, zoom: { enabled: true } });
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 1040
Zoom effect on AJAX loaded image · Issue #1040 · dimsemenov/Magnific-Popup
March 13, 2022 - $('.image-zoom').magnificPopup({ type: 'image', mainClass: 'mfp-with-zoom', // this class is for CSS animation below zoom: { enabled: true, // By default it's false, so don't forget to enable it duration: 300, // duration of the effect, in milliseconds easing: 'ease-in-out', // CSS transition easing function // The "opener" function should return the element from which popup will be zoomed in // and to which popup will be scaled down // By defailt it looks for an image tag: opener: function(openerElement) { // openerElement is the element on which popup was initialized, in this case its <a> tag // you don't need to add "opener" option if this code matches your needs, it's defailt one.
Author federicovilla
GitHub
gist.github.com › 8a99d9b55790aaf3ffbb069bb437d636
magnific-popup-single-zooming-image · GitHub
October 17, 2015 - magnific-popup-single-zooming-image. GitHub Gist: instantly share code, notes, and snippets.
Discourse
meta.discourse.org › ux
Magnific Popup mobile css - UX - Discourse Meta
May 14, 2021 - Hello, I just share you this little mfp css correction for mobile specially on gallery view. So with this css only the image will scroll the other things arrows, close and title will be fixed also when zoom in and scrolling. Place this code to the mobile css section I updated this code @media (max-width: 900px) { .mfp-container { position: fixed; overflow: auto; } .mfp-force-scrollbars { .mfp-figure { overflow: auto; } } }
Kriesi
kriesi.at › home › topics › enfold › show gallery in lightbox on button click with magnific popup
Show gallery in lightbox on button click with Magnific Popup - Support | Kriesi.at - Premium WordPress Themes
June 4, 2017 - function fs_magnific_popup(){ ?> <script> (function($){ $(window).load(function() { $('.fs-hochzeit-button').magnificPopup({ items: [ { src: 'https://www.fotosphere.de/wp-content/uploads/2017/05/hund-sonnenbrille-1500x996.jpg' }, { src: ' https://www.fotosphere.de/wp-content/uploads/2017/06/Texas-Lightning-2.jpg' } ], gallery: { enabled: true }, mainClass: 'avia-popup mfp-zoom-in mfp-image-loaded', type: 'image' }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'fs_magnific_popup');