jsor / lity

Lightweight, accessible and responsive lightbox.
https://sorgalla.com/lity/
MIT License
1.16k stars 196 forks source link

Opening Lity scrolls page to top #198

Open gavin310 opened 6 years ago

gavin310 commented 6 years ago

When I click a lity link, using something like <a href="#team-member-asdfasdf" data-lity> Lity opens fine, but after closing Lity the page is scrolled to the top. I'm using Lity on a page with a long list of bios, so it's very annoying having to scroll back down every time. Is this normal Lity behavior, or is it a bug?

jsor commented 6 years ago

Are you using a <a href="#"> as closing control? Try using a <button> or use a workaround like:

$(document).on('click', '[data-lity-close]', function (e) {
    e.preventDefault();
});