Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. .modal
  2. {
  3. display: block;
  4. overflow: auto;
  5. overflow-y: scroll;
  6. position: fixed;
  7. top: 0;
  8. right: 0;
  9. bottom: 0;
  10. left: 0;
  11. z-index: 99;
  12. -webkit-overflow-scrolling: touch;
  13. outline: 0;
  14. background-image: url('/assets/images/pixel.png');
  15. opacity: 1;
  16. }
  17.  
  18. .modal-dialog
  19. {
  20. max-width: 600px;
  21. background-color: white;
  22. z-index: 99;
  23. min-height: 200px;
  24. opacity: 0;
  25. -webkit-transition: all 0.5s ease;
  26. -moz-transition: all 0.5s ease;
  27. -o-transition: all 0.5s ease;
  28. transition: all 0.5s ease;
  29. }
  30.  
  31. .modal-dialog .active
  32. {
  33. opacity: 1;
  34. background-color: #ffffff;
  35. border: 1px solid #999;
  36. -webkit-background-clip: padding-box;
  37. -moz-background-clip: padding-box;
  38. background-clip: padding-box;
  39. -webkit-transition: all 0.5s ease;
  40. -moz-transition: all 0.5s ease;
  41. -o-transition: all 0.5s ease;
  42. transition: all 0.5s ease;
  43.  
  44. }
  45.  
  46. $('body').on('click', '[data-modal]', function(e){
  47. e.preventDefault();
  48.  
  49. $('body').addClass('modal-open');
  50.  
  51. $('body').append("<div class='modal'></div>").addClass('active');
  52.  
  53. $('.modal').append("<div class='modal-dialog'></div>")
  54.  
  55. $('.modal-dialog').html("<div class='modal-inner generic- content'></div>").addClass('active');
  56.  
  57. <body>
  58. <input type="button" id="open" value="Open"/>
  59. </body>
  60.  
  61. $('body').addClass('modal-open');
  62.  
  63. $('body').append("<div class='modal' style='display:none'></div>").addClass('active');
  64.  
  65. $('.modal').append("<div class='modal-dialog'></div>")
  66.  
  67. $('.modal-dialog').html("<div class='modal-inner generic-content'>/div>").addClass('active');
  68.  
  69.  
  70. $('#open').on('click', function(e){
  71. $(".modal").fadeIn(400);
  72. $(this).focusout();
  73. $("body").focusin();
  74. });
  75.  
  76. $("body").keydown(function(evt){
  77. if(evt.keyCode == 13)
  78. {
  79. $(".modal").fadeOut(400);
  80. }
  81. });
  82.  
  83. $("div").click(function(evt){
  84. $(".modal").fadeOut(400);
  85. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement