Advertisement
absorr

testmodal.html

Mar 12th, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.22 KB | None | 0 0
  1. <html>
  2. <head>
  3.     <title>Page Title</title>
  4.     <link rel="stylesheet" href="assets/css/bootstrap.css" />
  5.     <link rel="stylesheet" href="assets/css/bootstrap-responsive.css" />
  6.     <script src="assets/js/bootstrap.js" ></script>
  7.     <script src="assets/js/bootstrap.min.js"></script>
  8.     <script src="assets/js/bootstrap-modal.js"></script>
  9.     <script>
  10.         function registerItem(id, name, picurl, descDiv, statTitles, statDetails, recType, recItems)
  11.         {
  12.             var items = document.getElementById('itemhold').innerHTML;
  13.             var pops = document.getElementById('pophold').innerHTML;
  14.             document.getElementById('itemhold').innerHTML = items + '<h4 onClick="$(\''+ id +'\').modal(\'toggle\')"><img src="'+ picurl +'" height="30">'+ name +'</h4>';
  15.             document.getElementById('pophold').innerHTML = pops + '<div id="'+ id +'" class="modal hide fade"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button><h3><img src="' + picurl +' height="30"> ' + name + '</h3></div><div class="modal-body">'+ document.getElementById(descDiv).innerHTML +'</div></div>';
  16.         }
  17.         function items()
  18.         {
  19.             registerItem('expop', 'Example 1', 'http://placehold.it/30x30', 'itemdesc', 'hi', 'hi', 'crafting', 'hi');
  20.             registerItem('expopx', 'Example 2', 'http://placehold.it/30x30', 'itemdesc', 'hi', 'hi', 'crafting', 'hi');
  21.         }
  22.     </script>
  23. </head>
  24. <body onLoad="items()">
  25.  
  26.     <div id="itemdesc" class="hide">
  27.         This item is an item. <h1>Title</h1> Hi!
  28.     </div> 
  29.     <div id="itemhold"></div>
  30.     <div id="pophold"></div>
  31.    
  32.     <!-- Button to trigger modal -->
  33. <a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>
  34.  
  35. <!-- Modal -->
  36. <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  37.   <div class="modal-header">
  38.     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  39.     <h3 id="myModalLabel">Modal header</h3>
  40. </div>
  41.   <div class="modal-body">
  42.     <p>One fine body…</p>
  43.   </div>
  44.   <div class="modal-footer">
  45.     <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
  46.     <button class="btn btn-primary">Save changes</button>
  47.   </div>
  48. </div>
  49.  
  50.  
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement