GithubHelp home page GithubHelp logo

Comments (8)

jschr avatar jschr commented on July 21, 2024

Unfortunately I can't think of an easy way to fix this without a major overhaul. The problem is that the modal-container is responsible for scrolling every open modal and only exists once. The modal backdrop is created for each modal and needs to sit on top. The modal container and backdrop are both position fixed which causes the backdrop to cover the scroll bar. I need the backdrop on top of the container because it is also responsible for closing it's modal when clicked. What I think might be the solution is:

  1. Create a modal container for each modal
  2. z-index it so it is on top of the backdrop
  3. Make the modal container have the click event to close it's modal

I think this may solve your problem as well as another one; since there is only one modal container, having one large modal will cause it to scroll even when smaller modals are stacked on top.

I will have to think about it some more because it would be a fairly big change but if you have any other ideas I'd be glad to hear them.

Thanks

from bootstrap-modal.

seanhotw avatar seanhotw commented on July 21, 2024

I am also struggling to get scrolling works with multiple modals. I think having a modal container for each modal makes sense.

from bootstrap-modal.

jschr avatar jschr commented on July 21, 2024

@seanhotw Can you elaborate on some of the difficulties you are having?

from bootstrap-modal.

seanhotw avatar seanhotw commented on July 21, 2024

I am trying to make individual modal to have its own scrollable container, so that one layer will not affect the others.

What's happening now is every modal is under the same modal-container, if the first modal is overflowed but the second one is not, the second modal is still scrollable. Also, the backdrop is covering the modal-container completely, which means the modal can only be scrolled inside content area, it would be nice if the modal is scrollable anywhere on the page like what pinterest does to their modals.

Rather than do this

modal-container
-- modal
-- modal-backdrop
-- modal
-- modal-backdrop

I am hoping to make it work like this

modal-container
-- scrollable-container
---- modal
-- modal-backdrop
-- scrollable-container
---- modal
-- modal-backdrop

from bootstrap-modal.

jschr avatar jschr commented on July 21, 2024

@seanhotw ya that's kind of what I'm thinking except I'm not sure if you would need a modal-container anymore as the scrollable-container would serve the same purpose I think. This would also eliminate the dependency on creating a modal-container as part of the setup which would be nice.

Thanks for the ideas, when I get some time I hope to start implementing this. Feel free to share any code if you have any!

from bootstrap-modal.

jschr avatar jschr commented on July 21, 2024

This is now resolved in the current wip-2.0 branch.

from bootstrap-modal.

Yohn avatar Yohn commented on July 21, 2024

nice man!! glad you were able to figure something out for it :)
I converted all modals on my site to use your modal.js, and its working nice! I also added the ability to drag / move the modals with the tiny drags.js plugin

from bootstrap-modal.

jschr avatar jschr commented on July 21, 2024

Sounds cool! The solution I came up with actually solved a couple issues I have with the current modals but unfortunately could be a breaking change hence why it's a major version release.

I'll push the new version soon, just finishing up some testing. If you're feeling adventurous I would be curious to see how well they perform in your environment :)

Regardless, thanks for posting the issue!

from bootstrap-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.