Today I came across this post and found that the following code worked for me. I just got attached to bootstrap events and created the background on the fly. I wanted to set the opacity so that the user knew that clicking on the iframe part would do nothing. Also, I have pages that do not include iframes, and I wanted them to function the same. I had to disable scrolling for non iframe pages. Hope this code helps.
var navBackdrop = $('<div id="nav-backdrop" class="modal-backdrop" tabindex="-1" style="z-index: 0; top: 50px; overflow-y: auto; display: none; opacity: .4"></div>'); $(document).ready(function () { $("body").append(navBackdrop); $(".navbar").on("shown.bs.dropdown", ".dropdown", function () { navBackdrop.show(); $("body").css("overflow", "hidden"); }).on("hide.bs.dropdown", ".dropdown", function () { navBackdrop.hide(); $("body").css("overflow", "auto"); }); });
source share