Advertisement
Mihalytch

Bootstrap Modal

Mar 20th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.29 KB | None | 0 0
  1. <html>
  2.     <head>
  3.         <title>Test Modal</title>
  4.        
  5.         <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
  6.         <script type="text/javascript" src="jquery-1.7.1.min.js"></script>
  7.         <script src="js/bootstrap.min.js"></script>
  8.        
  9.         <script type="text/javascript">
  10.             (function( $ ) {
  11.                 $.sbModal = function(title) {
  12.                    
  13.                     var html = '<div id="myModal" class="modal hide fade">'
  14.                         + '<div class="modal-header">'
  15.                         + '<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>'
  16.                         + '<h3>'+title+'</h3>'
  17.                         + '</div>'
  18.                         + '<div class="modal-body">'
  19.                         + '<p>One fine body…</p>'
  20.                         + '</div>'
  21.                         + '<div class="modal-footer">'
  22.                         + '<a href="#" class="btn">Close</a>'
  23.                         + '<a href="#" class="btn btn-primary">Save changes</a>'
  24.                         + '</div>'
  25.                         + '</div>';
  26.                        
  27.                     $o = $(html);
  28.                    
  29.                     $find = $('#myModal');
  30.                     if ($find.length>0) {
  31.                         $find.remove();
  32.                     }
  33.                    
  34.                     $o.appendTo('body').modal();
  35.                    
  36.                 }
  37.            
  38.                 $(document).ready(function(){
  39.                
  40.                     $('#show_login').click(function(){
  41.                         $.sbModal('hello title');
  42.                         return false;
  43.                     });
  44.                    
  45.                 });
  46.             })( jQuery );
  47.         </script>
  48.     </head>
  49.     <body>
  50.         <a href="#123123" id="show_login">Login</a>
  51.     </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement