Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dom-task #359

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
dom-task
  • Loading branch information
sofiichuk committed Aug 30, 2022
commit 14f8970d83991b83f9076c0e68c4afb301c495a3
25 changes: 25 additions & 0 deletions submissions/sofiichuk/dom-task/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>the seven</title>
<link href="style.css" rel="stylesheet">
<script async src="script.js"></script>
</head>
<body>
<nav>
<ul class="sideMenu">
<li class="sideMenu__item" id="red">1</li>
<li class="sideMenu__item" id="orange">2</li>
<li class="sideMenu__item" id="yellow">3</li>
<li class="sideMenu__item" id="green">4</li>
<li class="sideMenu__item" id="blue">5</li>
<li class="sideMenu__item" id="indigo">6</li>
<li class="sideMenu__item" id="violet">7</li>
</ul>
</nav>
<main class="mainContent">
<h1 class="text">only here and now:<br>the ULTIMATE<br>catalog of the rainbow colors!</h1>
</main>
</body>
</html>
8 changes: 8 additions & 0 deletions submissions/sofiichuk/dom-task/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
let mainContent = document.querySelector(".mainContent");

let sideMenu = document.querySelector('.sideMenu');

sideMenu.addEventListener('click', function (event) {
mainContent.style.backgroundColor = event.target.id;
document.querySelector(".text").innerText = event.target.id;
});
71 changes: 71 additions & 0 deletions submissions/sofiichuk/dom-task/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
* {
margin: 0;
padding: 0;
border: 0;
box-sizing: border-box;
color: #fff;
}

.sideMenu {
display: flex;
flex-direction: column;
width: 20%;
text-align: center;
list-style: none;
position: fixed;
bottom: 0;
left: 0;
top: 0;
}

.sideMenu__item {
height: 100%;
cursor: pointer;
font-size: 30px;
padding-top: 30px;
}

#red {
background: red;
}

#orange {
background: orange;
}

#yellow {
background: yellow;
}

#green {
background: green;
}

#blue {
background: blue;
}

#indigo {
background: indigo;
}

#violet {
background: violet;
}

.mainContent {
left: 20%;
width: 100%;
position: fixed;
bottom: 0;
right: 0;
top: 0;
background: black;
}

.text {
position: relative;
text-align: center;
top: 40%;
right: 10%;
}