javascript - How to change background Opacity when bootstrap modal is open -
I am using the bootstrap model when the opacity of the modal open background material is not changed by default. I tried to convert to JS
ShowModel function () {document.getElementById ("pageContent"). Style.opacity = "0.5"; }
}
It is working, but when the modal is closed the ambiguity style still stays for the page. But, I'm sure this is not the right way to do it. Any help appreciated Thanks. HTML button that opens the modal
& lt; Button class = "btn glossy-clear" data-toggle = "modal" data-target = "# modal-display" onclick = "showModal ()" & gt; Clean & lt; / Button & gt; The model code is
& lt; Div class = "modal fade" id = "modal-display" & gt; & Lt; Div class = "modal-dialog" & gt; & Lt; Div class = "modal-content" & gt; & Lt; Div class = "modal-header" & gt; & Lt; Button type = "button" class = "off" data-rejected = "modal" aria-label = "close" & gt; & Lt; Span aria-hidden = "true" & gt; And;; & Lt; / Span & gt; & Lt; / Button & gt; & Lt; H4 class = "modal-title" & gt; Search results & lt; / H4 & gt; & Lt; / Div & gt; & Lt; Div class = "modal-body" & gt; & Lt; Div class = "container" & gt; & Lt; Div class = "row" & gt; & Lt; Div class = "col-md-5" & gt; Hello & lt; / Div & gt; & Lt; Div class = "col-md-5" & gt; I !!!! & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; Edit
I assume that you want to set the opacity of the modal background ...
Set Opacity via CSS
. Model-BailDrope {Opacity: 0.5! Important; }
! Important prevents opacity from overwriting - especially from this bootstrap in this context.
Comments
Post a Comment