greenmelon

pop up

Dec 13th, 2021 (edited)
1,508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. <head>
  2. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script>
  3. $(document).ready(function(){
  4. $('.click,.fade').click(function() {
  5. $('#pop').fadeToggle();
  6. });
  7. });
  8. </script>
  9. </head>
  10.  
  11. <style>
  12. .click { cursor:help } /* for question mark cursor on hover */
  13.  
  14. #pop {
  15. width:100%;
  16. height:100%;
  17. top:0;left:0;
  18. position:fixed;
  19. z-index:999;
  20. background:rgba(255,255,255,.9); /* background of popup. adjust the .9 for the opacity of the background (1 will be solid white, .5 will be semi transparent, etc.) */
  21. display:none;
  22. }
  23. .fade {
  24. top:0;
  25. left:0;
  26. position:fixed;
  27. z-index:1000;
  28. width:100%;
  29. height:100%;
  30. }
  31.  
  32. .popup {
  33. top:50%;
  34. left:50%;
  35. transform:translate(-50%,-50%);
  36. position:fixed;
  37. background:#fff; /* background of popup box */
  38. padding:10px; /* padding of popup box */
  39. z-index:10000;
  40. max-width:300px; /* width of popup */
  41. border:1px solid #eee; /* popup border */
  42. }
  43.  
  44. .click {
  45. top:20px; /* distance from top */
  46. right:20px; /* distance from right - you can change this to left if you like */
  47. position:fixed;
  48. }
  49. </style>
  50.  
  51. <body>
  52. <div class="click">Popup</div>
  53. <div id="pop"> <div class="fade"></div>
  54. <div class="popup">
  55. Cupcake ipsum dolor sit amet sweet tiramisu dessert. Chupa chups jelly dessert wafer lemon drops powder. Tootsie roll I love powder chocolate cake gummi bears jujubes gingerbread. Muffin jelly-o jelly-o candy canes pudding.
  56. </div>
  57. </div>
  58. </body>
Add Comment
Please, Sign In to add comment