I am using this OverlayScrollbars plugin and trying to use it on body
tag. Everything else is working fine but when I open the bootstrap modal it gets black and unclickable:
$(function() {
//The passed argument has to be at least a empty object or a object with your desired options
$("body").overlayScrollbars({ });
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/overlayscrollbars/1.5.2/css/OverlayScrollbars.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/overlayscrollbars/1.5.2/js/jquery.overlayScrollbars.min.js"></script>
<html> <body> Lorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsum <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#flipFlop"> Click Me </button> <!-- The modal --> <div class="modal fade" id="flipFlop" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h4 class="modal-title" id="modalLabel">Modal Title</h4> </div> <div class="modal-body"> Modal content... </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </div> </div> </div> </div> </body> </html>
Already opened an issue on Github and the suggested solution is to place modal outside of the body (that is not possible in my case here).
So Any other jquery/js/CSS soltuion?
2
Answers
Another Solution from the developer of this plugin.
You are having some problems with z-index here. After playing a bit with z-index in DOM inspector, I’ve came up with this simple fix:
It works for me in jsFiddle but doesn’t work in SO snippet (hm, that’s the first time I get such difference). I works, though, if I apply your suggestion to set CSS rule as
important
:I hope it will work for you on your page; anyway, this is the direction you should look into to get that fixed.