A Modal plugin is used to create a dialog box that is displayed on top of the current page with or without an overlay. There are several classes that are associated with a modal:
Class | Description |
---|---|
.modal | Creates a modal |
.modal-content | Creates the content area for the header, body, and footer |
.modal-header | Defines the header style |
.modal-body | Defines the body style |
.modal-footer | Defines the footer style |
.modal-sm | Creates a small modal |
.modal-lg | Creates a large modal |
.fade | Adds a fade transition effect |
<li><a href="#" data-toggle="modal" data-target="#loginModal"> <span id="login_menu_icon_color" class="glyphicon glyphicon-log-in"></span> Login</a></li>
<!-- Modal Dialog Box for Login ---------- -->
<div id="loginModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<p> Form for login goes here....</p>
</div>
</div>
</div> <!-- end of modal dialog box -->
<!-- jQuery (necessary for Bootstrap's JavaScript plug-ins) -->
<!-- Modal Dialog Box for Login ---------- -->
<div id="loginModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Login</h4>
</div>
<div class="modal-body">
<p>Create form for login here...</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div> <!-- end of modal dialog box -->
<!-- jQuery (necessary for Bootstrap's JavaScript plug-ins) -->
<li><a href="login.html" data-toggle="modal" data-target="#loginModal"> <span id="login_menu_icon_color" class="glyphicon glyphicon-log-in"></span> Login</a></li>
<!doctype html>
<html lang="en">
<head>
<title>Login</title>
</head>
<body>
<!-- Modal -->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h2><span class="glyphicon glyphicon-lock"></span> Login</h2>
</div>
<div class="modal-body">
<form role="form">
<div class="form-group">
<label for="email"><span class="glyphicon glyphicon-user"></span> Email</label>
<input type="email" class="form-control" id="email" placeholder="Enter email" required>
</div>
<div class="form-group">
<label for="password"><span class="glyphicon glyphicon-eye-open"></span> Password</label>
<input type="password" class="form-control" id="password" placeholder="Enter password" required>
</div>
<div class="checkbox">
<label><input type="checkbox" value="" checked>Remember me</label>
</div>
<button type="submit" class="btn btn-default">
<span class="glyphicon glyphicon-off"></span> Login</button>
</form>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-danger btn-default pull-left" data-dismiss="modal">
<span class="glyphicon glyphicon-cancel"></span> Cancel</button>
<p>Not a member? <a href="#">Sign Up</a></p>
<p>Forgot <a href="#">Password?</a></p>
</div>
</div>
</body>
</html>