I am trying to use bootstrap front end library to automatically open a pop up page with instructions on how to use my site. I can make the modal show on page load but that’s all it shows. I want to show it over my regular page and then users can then dismiss it after they read the instructions. I don’t know how to make it happen. I am not using regular HTML pages on my site. I am using Omeka CMS. What I understand I need to do is the following but I don’t know how to actually do it. I need to:
- put the markup for the modal in a custom show.php file
- put the code to initialize the modal in script.js file (does it have to be script.js? I’m already using script.js for something else)
Right now I have all the code in show.php which shows the modal but not over my actual page and once you dismiss the dialog nothing happens. So somehow I need alter the show.php and create script.js file to make it work as intended. I don’t know what code to put in script.js and I don’t know how/where to call the script.js file.
This is the php that shows my modal but not in the way I want to use it
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<script src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(window).load(function() {
$('#myModal').modal('show');
});
</script>
</head>
<body>
<!-- Modal -->
<div id="myModal" class="modal fade">
<div class="modal-dialog">
<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">Modal title</h4>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</body>
</html>
I would appreciate any help anyone can provide.
Thank you
Sailaja
MSBI Developer