Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with webpage width when using zoom-out animation #1085

Open
srikat opened this issue Sep 19, 2018 · 0 comments
Open

Issues with webpage width when using zoom-out animation #1085

srikat opened this issue Sep 19, 2018 · 0 comments

Comments

@srikat
Copy link

srikat commented Sep 19, 2018

Test page: https://oxygen.wpdemos.net/magnific-popup-test-page/

With the above page opened in a phone, when the second button having the text of "Single image lightbox (with zoom out animation)" is clicked, the body of the webpage seems to shrink and then go back to its regular width.

Screencast: https://cl.ly/f1cb430ede72

HTML:

<a id="link_button-12-519" class="ct-link-button mfp-zoom-out" href="https://oxygen.wpdemos.net/wp-content/uploads/2018/09/modern-white-house.jpg" target="_self">Single image lightbox (with zoom out animation)</a>

CSS:

.mfp-zoom-out .mfp-with-anim {
  opacity: 0;
  transition: all 0.3s ease-in-out;
  transform: scale(1.3);
}
.mfp-zoom-out.mfp-bg {
  opacity: 0;
  transition: all 0.3s ease-out;
}
.mfp-zoom-out.mfp-ready .mfp-with-anim {
  opacity: 1;
  transform: scale(1);
}
.mfp-zoom-out.mfp-ready.mfp-bg {
  opacity: 0.8;
}
.mfp-zoom-out.mfp-removing .mfp-with-anim {
  transform: scale(1.3);
  opacity: 0;
}
.mfp-zoom-out.mfp-removing.mfp-bg {
  opacity: 0;
}

JS:

jQuery('.mfp-zoom-out').magnificPopup({
	type: "image",
  
  // Delay in milliseconds before popup is removed
  removalDelay: 500,

  // Class that is added to popup wrapper and background
  // make it unique to apply your CSS animations just to this exact popup
  mainClass: 'mfp-zoom-out',
  
  callbacks: {
    beforeOpen: function() {
      // just a hack that adds mfp-anim class to markup 
       this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
       // this.st.mainClass = this.st.el.attr('data-effect');
    }
  },
  closeOnContentClick: true,
  midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
});

The problem is not present when the page is viewed at smaller widths in Chrome.

Any advice on fixing this will be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant