Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Document</title>
- <style>
- #divt {
- width: 300px;
- height: 300px;
- text-align: center;
- background: black;
- margin-top: 100px;
- }
- </style>
- <script src="jquery.js"></script>
- <script>
- $(document).ready(function () {
- $("#divt").on("mouseout", function () {
- $("#divt")
- .css("background", "black")
- })
- $("#g").on("click", function () {
- var f = !$("#g").data("toggleFlag");
- if (f) { // Jeśli jest włączone
- console.log("Włączenie działania")
- $("#g")
- .html('Wylacz dzialanie')
- $("#divj")
- .html("<p> Działa </p>")
- $("#divt").on("mouseover", function () {
- $("#divt")
- .css("background", "red")
- .html("<p> xD </p>")
- .css("font-weight", "bold")
- .css("font-size", "250%")
- })
- } else { // Jeśli jest wyłączone
- console.log("Wyłączenie działania")
- $("#divj")
- .html("<p> Nie Działa </p>")
- $("#g")
- .html('Wlacz Dzialanie')
- $("#divt").on("mouseover", function () {
- $("#divt")
- .css("background", "black")
- })
- }
- $("#g").data("toggleFlag", f);
- })
- })
- </script>
- </head>
- <body>
- <div id="divj">
- <p> Nie Działa </p>
- </div>
- <div id="divt">
- </div>
- <button id="g"> Wlacz dzialanie </button>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement