Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
pxeemo authored May 18, 2021
0 parents commit 6167e1a
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 0 deletions.
80 changes: 80 additions & 0 deletions index.html
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>
30 changes: 30 additions & 0 deletions main.js
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");
}
})
});
42 changes: 42 additions & 0 deletions style.css
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;
}

0 comments on commit 6167e1a

Please sign in to comment.