Advertisement
Griwin

Js -problem

Dec 17th, 2022
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.80 KB | Source Code | 0 0
  1. import "../scss/app.scss";
  2.  
  3. window.addEventListener("DOMContentLoaded", () => {
  4.   // This block will be executed once the page is loaded and ready
  5.   const button = document.querySelector(".button");
  6.   button.addEventListener("click", () => {
  7.     alert("💣");
  8.          });
  9.  
  10.    
  11.          const img = document.querySelector(".image");
  12.     let scale = false
  13.     img.addEventListener("click", () => {      
  14.       if (scale) {
  15.         img.style.transform = "scale(1)"
  16.         img.style.transition = "transform 0.25s ease";
  17.         scale = false;
  18.         return;
  19.       }
  20.    
  21.       if (!scale) {
  22.         img.style.transform = "scale(2)";
  23.         img.style.transition = "transform 0.25s ease";
  24.         scale = true;
  25.         return;
  26.       }
  27.       console.log(scale);
  28.        
  29.     });
  30.  
  31. });
  32.  
Tags: js
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement