Advertisement
Guest User

Untitled

a guest
Sep 9th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>Document</title>
  9. <style>
  10. #divt {
  11. width: 300px;
  12. height: 300px;
  13. text-align: center;
  14. background: black;
  15. margin-top: 100px;
  16. }
  17. </style>
  18. <script src="jquery.js"></script>
  19. <script>
  20. $(document).ready(function () {
  21.  
  22.  
  23.  
  24. $("#divt").on("mouseout", function () {
  25. $("#divt")
  26. .css("background", "black")
  27. })
  28.  
  29.  
  30. $("#g").on("click", function () {
  31. var f = !$("#g").data("toggleFlag");
  32. if (f) { // Jeśli jest włączone
  33. console.log("Włączenie działania")
  34. $("#g")
  35. .html('Wylacz dzialanie')
  36. $("#divj")
  37. .html("<p> Działa </p>")
  38. $("#divt").on("mouseover", function () {
  39. $("#divt")
  40.  
  41. .css("background", "red")
  42. .html("<p> xD </p>")
  43. .css("font-weight", "bold")
  44. .css("font-size", "250%")
  45. })
  46. } else { // Jeśli jest wyłączone
  47. console.log("Wyłączenie działania")
  48. $("#divj")
  49. .html("<p> Nie Działa </p>")
  50. $("#g")
  51. .html('Wlacz Dzialanie')
  52. $("#divt").on("mouseover", function () {
  53. $("#divt")
  54. .css("background", "black")
  55.  
  56.  
  57. })
  58. }
  59. $("#g").data("toggleFlag", f);
  60. })
  61. })
  62. </script>
  63.  
  64.  
  65. </head>
  66.  
  67. <body>
  68. <div id="divj">
  69. <p> Nie Działa </p>
  70. </div>
  71.  
  72. <div id="divt">
  73. </div>
  74. <button id="g"> Wlacz dzialanie </button>
  75. </body>
  76.  
  77. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement