Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>modal test</title>
  5. <meta charset="utf-8"/>
  6. <link rel="stylesheet" href="css/foundation.min.css">
  7. <script type="text/javascript" src="js/vendor/jquery.min.js"></script>
  8. </head>
  9. <body>
  10. <div id="headerContainer">
  11. <a href="#" class="button" data-open="modalForm">Show Modal</a>
  12. </div>
  13. <div id="modalContainer">
  14.  
  15. <!-- start: modalForm content -->
  16. <div class="reveal" data-reveal id="modalForm" role="dialog" >
  17. <div class="row" >
  18. <div class="medium-12 large-12 columns">
  19. <p>modal test</p>
  20. <button class="close-button" data-close aria-label="Close reveal" type="button"> <span aria-hidden="true">&times;</span> </button>
  21. </div>
  22. </div>
  23. </div>
  24. <!-- end: modalForm content -->
  25.  
  26.  
  27. </div>
  28. <script src='js/foundation.min.js'></script>
  29. <script>
  30. //$("#modalContainer").load("_form-modal-test.html", function() {
  31. $(document).foundation();
  32. //});
  33. </script>
  34. </body>
  35. </html>
  36.  
  37. <!doctype html>
  38. <html>
  39. <head>
  40. <title>modal test</title>
  41. <meta charset="utf-8"/>
  42. <link rel="stylesheet" href="css/foundation.min.css">
  43. <script type="text/javascript" src="js/vendor/jquery.min.js"></script>
  44. </head>
  45. <body>
  46. <div id="headerContainer">
  47. <a href="#" class="button" data-open="modalForm">Show Modal</a>
  48. </div>
  49. <div id="modalContainer"></div>
  50. <script src='js/foundation.min.js'></script>
  51. <script>
  52. $("#modalContainer").load("_form-modal-test.html", function() {
  53. $(document).foundation();
  54. });
  55. </script>
  56. </body>
  57. </html>
  58.  
  59. $(window).resize(function(){
  60. reveal._setPosition();
  61. });
  62.  
  63. <div class="reveal" id="exampleModal1">
  64. <p>Some random text. Not loading the json file here.</p>
  65. </div>
  66.  
  67. <script>
  68. $(document).foundation();
  69. var modal = $('#exampleModal1');
  70. var reveal = new Foundation.Reveal(modal);
  71. $('button').click(function(){
  72. $.ajax('test.html')
  73. .done(function(resp){
  74. modal.html(resp);
  75. reveal.open();
  76. });
  77. });
  78. </script>
  79.  
  80. - Write a function that returns a string with the HTML code you want to implement inside the reveal (so that in the view, you only have <div id="myReveal" data-reveal></div>). Let's call this function revealHtmlFactory(). So it will return ´<h1>My Dinamic Reveal</h1>´ etc.
  81. - Then, you set a handler for a button that will be the reveal toggler. Let's call this onRevealToggle(). This handler will 1) $('#myReveal').html(revealHtmlFactory()); 2) $(document).foundation(); 3) $('#myReveal').foundation('open');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement