Giter Site home page Giter Site logo

Page jumps to top about css-modal HOT 10 CLOSED

drublic avatar drublic commented on May 23, 2024
Page jumps to top

from css-modal.

Comments (10)

staabm avatar staabm commented on May 23, 2024

just add a "return false" onclick handler and you are fine.

from css-modal.

kahlil avatar kahlil commented on May 23, 2024

Or use a button tag instead of a link?

from css-modal.

Schepp avatar Schepp commented on May 23, 2024

I think it's the doctype! ;D

Jokes aside, the reason is that the body is being set to overflow: hidden, and I think @drublic is well aware of it and will find a good fix.

from css-modal.

kahlil avatar kahlil commented on May 23, 2024

Yes, I am very confident in @drublic's ability to find a fix as well. 👍 😄

from css-modal.

ryanseddon avatar ryanseddon commented on May 23, 2024

You may want to checkout @benschwarz http://benschwarz.github.io/gallery-css/ project where he uses a super cool trick to stop the jump happening by using hidden divs with the ids that then use general sibling combinator (~) to target the right item.

from css-modal.

benschwarz avatar benschwarz commented on May 23, 2024

Thanks @ryanseddon, I was actually going to PR something when I saw this project, but I hadn't had the chance yet.

from css-modal.

drublic avatar drublic commented on May 23, 2024

Thanks, Ryan! I'll check it out.
@benschwarz PR is always very welcome :)

from css-modal.

drublic avatar drublic commented on May 23, 2024

If I invested correctly, this means we need extra markup to target each hidden div. I use this method a lot for navigations, especially on mobile where you need a toggle button for the menu to be visible or not. It is also a method that I use in a modified version for the tabbed content on the page.
To be honest I don't think this will work perfectly with the modals since the jumping bug originates in preventing the overflow for the content an thus prevent scrolling the content.
I will try out some more and come up with a solution shortly.

from css-modal.

drublic avatar drublic commented on May 23, 2024

And here is the solution. Pretty easy. Please let me know if you find any bugs in this fix.
I've also added a test to prevent regression.

from css-modal.

kahlil avatar kahlil commented on May 23, 2024

Sweet. Works great now.

Am 10.05.2013 um 23:10 schrieb Hans Christian Reinl [email protected]:

And here is the solution. Pretty easy. Please let me know if you find any bugs in this fix.
I've also added a test to prevent regression.


Reply to this email directly or view it on GitHub.

from css-modal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.