height: 100vh on body element causes page to jump to top when opening fancybox
Using this code in my website's css causes the page to jump when opening fancybox.
body { display: flex; flex-direction: column; height: 100vh; }
It appears to be caused by this rule in jquery.fancybox.css;
body.fancybox-active { overflow: hidden; }
For me, the fix was to add this to my website's css file;
body.fancybox-active { overflow: initial !important; }
Just thought' I'd mention this for anyone else having this issue.
Hi,
Why do you think it is a good idea to make changes like these to the body element? I always wonder why people do crazy things and then ask - please, fix your script, it is not working on my page.
Why don't you create a root element for that layout thing and let poor body element alone? 😄
Anyway, the upcoming version (you can preview it here - https://codepen.io/fancyapps/pen/VyLOJX?editors=1010) seems to work fine with these CSS rules.
Why do you think it is a good idea to make changes like these to the body element?
I think we are both guilty of this ;)
Though I like your idea of creating a root element rather than using the body element. In my case, the css is for a "sticky footer".
Thanks for your help, and please keep up the great work.
Hmm, sticky footer? I think it can be achieved with simpler CSS - https://getbootstrap.com/docs/4.0/examples/sticky-footer/
Thanks for that, I'd like to use that simpler method, but it relies on a fixed height footer.
I had to use"vh" in my case to account for the dynamic height of the footer.