3
People need that as soon as the page load the modal of the bootstrap open on the screen without having to click the button, the way I am doing ta being necessary to click the button for the modal open, follows the code:
<button type="button" class="btn btn-primary construcao" data-toggle="modal" data-target="#exemplomodal">SITE EM CONSTRUÇÃO</button>
<div class="modal fade" id="exemplomodal" tabindex="-1" role="dialog" aria-
labelledby="myLargeModalLabel">
<div class="modal-dialog modal-lg" 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="gridSystemModalLabel">teste</h4>
</div>
<div class="modal-body">
teste
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#exemplomodal').modal('show');
})
</script>
Apparently you’re doing it the right way, strange it’s not working, try the following: $(window). load(Function()' $('#exemplomodal').modal('show'); }); if it doesn’t work, try a 100ms setTimeOut
– Mathiasfc
did not work, keeps opening only at the click of the button, in inspect appears that modal is not a function, this error is common ?
– André
So probably your error is in the scripts declaration, I will post as a reply, a moment.
– Mathiasfc
Just click on the button when you click on the page and give a . Hide() on the button.
– Vinicius De Jesus