Have the following code, trying to get it to take and stay on the night or day mode depending what is clicked for the whole site or if page is refreshed
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Day And Night Mode</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<style>
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
section {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100vh;
box-sizing: border-box;
padding: 100px;
transition: 0.5s;
}
section.dark {
background: #262626;
color: #fff;
}
ul {
position: absolute;
top: 20px;
right: 20px;
margin: 0;
padding: 0;
width: 100px;
height: 30px;
z-index: 1;
border: 1px solid #000;
border-radius: 4px;
cursor: pointer;
overflow: hidden;
}
ul.active {
border-color: #fff;
}
ul li {
list-style: none;
width: 100%;
height: 60px;
text-align: center;
text-transform: uppercase;
transition: 0.5s;
}
ul.active li {
transform: translateY(-30px);
}
ul li span {
display: block;
width: 100%;
height: 30px;
line-height: 30px;
color: #262626;
background: #fff;
}
ul li span:nth-child(1) {
background: #262626;
color: #fff;
}
</style>
<section>
<h1>What is Lorem ipsum ?</h1>
<p>"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains."</p>
<p>"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains."</p>
<p>"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains."</p>
</section>
<ul>
<li>
<span>Night</span>
<span>Light</span>
</li>
</ul>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('ul').click(function() {
$('ul').toggleClass('active')
$('section').toggleClass('dark')
})
})
</script>
</body>
</html>
What I have tried:
tried playing with the java but not able to figure it out to hold settings for refresh and or the whole site depending what mode your in thanks in advance