-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
28 lines (26 loc) · 1.11 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
let imageElement = document.getElementById("image");
let originalImageWidth = 200;
document.getElementById("imageWidth").textContent = "200px";
imageElement.style.width = originalImageWidth + "px";
function increase() {
if (originalImageWidth < 300) {
originalImageWidth = originalImageWidth + 5;
let width = originalImageWidth + "px";
imageElement.style.width = width;
document.getElementById("imageWidth").textContent = width;
document.getElementById("warningMessage").textContent = "";
} else {
document.getElementById("warningMessage").textContent = "Too big. Decrease the size of the Image.";
}
}
function decrease() {
if (originalImageWidth > 100) {
originalImageWidth = originalImageWidth - 5;
let width = originalImageWidth + "px";
imageElement.style.width = width;
document.getElementById("imageWidth").textContent = width;
document.getElementById("warningMessage").textContent = "";
} else {
document.getElementById("warningMessage").textContent = "Can't Visible. Increase the siza of the Image.";
}
}