I'm new to web coding, and I've been trying to make the custom modal show up clicking "About", but it simply doesn't happen, and I really have no clue of why, anyone knows? I put my full website, including CSS, because I simply don't know what's compatible and what's not compatible with bootstrap modal.
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<title>Documento senza titolo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="Style.css">
<link rel="icon" href="Senza titolo-1.ico">
</head>
<body>
<div id="main">
<br>
<br>
<div id="abovenavigation">
<ul class="container">
<li>
<h1 class="About"><a href="#" data-toggle="modal" data-target="#myModal">ABOUT</a></h1>
</li>
</ul><!--ends container-->
</div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<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" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-="" dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</body>
</html>
You really need to read up on the manual for modals. The easiest way is giving your
<a id="btn-show-modal">
a few extra attributes, namelydata-toggle="modal"
anddata-target="#dialog-example"
. Next, you're missing a few divs in your modal's structure:Notice the
modal-dialog
andmodal-content
; both were missing from your markup and causing weird behaviors. Also, I'm not sure whatmodal hide
is. Please read here for more information: http://getbootstrap.com/javascript/#modalsLive Demo: Bootply