Comments (8)
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:
- Create a modal container for each modal
- z-index it so it is on top of the backdrop
- 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.
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.
@seanhotw Can you elaborate on some of the difficulties you are having?
from bootstrap-modal.
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.
@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.
This is now resolved in the current wip-2.0 branch.
from bootstrap-modal.
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.
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)
- is there any compatibility issues with select2.js? HOT 1
- Construct ajax query (ie. ajax Contact form)
- can i use this without bootstrap HOT 1
- angular 1.2.* ng-include used inside ui-bootstrap - modal opening page scrolls to top
- Show Modal Without overlay.
- Modal opens with a delay compared to standard BS3 modal
- Use modal with form validation
- body class="modal-open" style="padding-right: 15px" HOT 1
- Modal don't scroll when closing top modal
- The bootstrap dependency is different between github repo and bower repo.
- make collapsable?
- event.relatedTarget()
- How to relocate modal inside into a div
- Publish as NPM package
- Incompatible with Boostrap 4? HOT 4
- when using this with bootbox.js ,the bootbox dialog style was confused HOT 9
- Stackable: Close modal when clicked outside
- Will you upgrade to Bootstrap 4? HOT 1
- event listener for complete loading
- Replaced # with javascript:; in this statement and it worked.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootstrap-modal.