-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6167e1a
Showing
3 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>صفحه اتللو</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<div id="nobat" class="white"></div> | ||
<div class="container"> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block black"></div> | ||
<div class="block white"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block white"></div> | ||
<div class="block black"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
<div class="block"></div> | ||
</div> | ||
<script src="main.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const container = document.querySelector('.container'); | ||
const blocks = document.querySelectorAll('.block'); | ||
const nobat = document.querySelector('#nobat'); | ||
let turnblack = false; | ||
|
||
if (window.matchMedia("(orientation: portrait)").matches) { | ||
// you're in PORTRAIT mode | ||
container.style.height = getComputedStyle(container).width; | ||
} else if (matchMedia("(orientation: landscape)").matches) { | ||
// you're in LANDSCAPE mode | ||
container.style.width = getComputedStyle(container).height; | ||
} | ||
|
||
blocks.forEach(e => { | ||
e.addEventListener("click", () => { | ||
if (e.classList.length === 1) { | ||
if (turnblack === true) { | ||
e.classList.add("black"); | ||
turnblack = false; | ||
} else { | ||
e.classList.add("white"); | ||
turnblack = true; | ||
} | ||
nobat.classList.toggle("black"); | ||
} else { | ||
e.classList.toggle("black"); | ||
e.classList.toggle("white"); | ||
} | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
html { | ||
background-color: #222; | ||
} | ||
#nobat { | ||
position: fixed; | ||
width: 10px; | ||
height: 10px; | ||
transition: background-color .5s; | ||
} | ||
.container { | ||
display: grid; | ||
background: #b17300; | ||
grid-template-columns: 12.5% 12.5% 12.5% 12.5% 12.5% 12.5% 12.5% 12.5%; | ||
box-sizing: border-box; | ||
position: absolute; | ||
left: 50%; | ||
top: 50%; | ||
transform: translate(-50%, -50%); | ||
} | ||
.block { | ||
border: 2px solid #ffa500; | ||
box-sizing: border-box; | ||
transition: background-color .5s; | ||
} | ||
@media screen and (orientation:portrait) { | ||
.container { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
} | ||
@media screen and (orientation:landscape) { | ||
.container { | ||
width: auto; | ||
height: 96vh; | ||
} | ||
} | ||
.white { | ||
background-color: #fff; | ||
} | ||
.black { | ||
background-color: #000; | ||
} |