-
Notifications
You must be signed in to change notification settings - Fork 0
/
toDo.html
218 lines (206 loc) · 5.17 KB
/
toDo.html
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Order Of The Day</title>
<script type="text/javascript"></script>
<style>
*{
margin: 0;
padding: 0;
font-family:Georgia, 'Times New Roman', Times, serif;
box-sizing:border-box;
}
body {
background-image: url('https://tse1.mm.bing.net/th?id=OIP.VxIWIX4oJq5ksyIE7LvgowHaEK&pid=Api&P=0&h=180your-background-image-url.jpg');
background-size: cover;
background-position: center;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.container{
width: 100%;
min-height: 51vh;
padding: 10px;
}
.order{
width: 100%;
max-width: 540px;
background: wheat;
margin: 100px auto 20px;
padding: 40px 30px 70px;
border-radius: 10px;
height: 800px;
}
.order h2{
color: rgb(16, 16, 16);
display: flex;
align-items: center;
margin-bottom: 20px;
}
.order h2 img{
width: 30px;
margin-left: 10px ;
}
.row{
display: flex;
align-items: center;
justify-content: space-between;
background: yellow;
padding-left: 20px;
border-radius:20px ;
margin-bottom: 25px;
}
.row:hover {
transform: scale(1.1);
}
input{
flex: 1;
border: none;
outline: none;
background: transparent;
padding: 10px;
font-weight: 14px;
}
button{
border: none;
outline: none;
padding: 16px 50px;
background: rgb(42, 212, 235);
color: black;
font-style: italic;
font-size: 16px;
cursor: pointer;
border-radius: 40px;
}
ul li{
list-style: none;
font-size: 18px;
padding: 12px 8px 12px 50px;
user-select: none;
cursor: pointer;
position: relative;
word-wrap:break-word;
}
ul li::before{
content: '';
position: absolute;
height: 28px;
width: 28px;
border-radius: 50%;
background-image: url('https://tse2.mm.bing.net/th?id=OIP.E0ARCTB6x8_BpUNT8XauOwHaHa&pid=Api&P=0&h=180');
background-size: cover;
background-position: center;
top:12px ;
left: 8px;
}
ul li.checked{
text-decoration: line-through;
}
ul li.checked::before{
background-image:url('https://tse3.mm.bing.net/th?id=OIP.ywAmzmSd5clHmaa0lijuBgHaHa&pid=Api&P=0&h=180');
}
ul li span{
position: absolute;
right: 0;
top: 5px;
width: 40px;
height: 40px;
font-size: 22px;
color: rgb(40, 39, 39);
line-height: 40px;
text-align: center;
border-radius: 50%;
}
ul line span:hover{
background: #edeef0;
}
ul li:hover {
background-color: rgba(0, 0, 0, 0.1);
}
@media screen and (max-width: 600px) {
.order {
padding: 10px;
}
.order h2 {
font-size: 18px;
}
.row {
padding-left: 10px;
}
.row input {
font-size: 12px;
}
.row button {
padding: 8px 16px;
font-size: 12px;
}
ul li {
font-size: 14px;
}
ul li::before {
height: 16px;
width: 16px;
top: 6px;
left: 3px;
}
ul li span {
width: 16px;
height: 16px;
font-size: 12px;
line-height: 16px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="order">
<h2>To-Do-List <img src="https://tse2.mm.bing.net/th?id=OIP.LizUYCSvTIjLQCJMz_YYbgHaHa&pid=Api&P=0&h=180" alt=""></h2>
<div class="row">
<input type="text" id="input-box" placeholder="Add Your Text">
<button onclick="addTask()" >Add</button>
</div>
<ul id="list-container">
</ul>
</div>
</div>
<script>
const inputBox = document.getElementById("input-box");
const listContainer = document.getElementById("list-container");
function addTask() {
if (inputBox.value === '') {
alert("You must write something!");
} else {
let li = document.createElement('li');
li.innerHTML = inputBox.value;
listContainer.appendChild(li);
let span = document.createElement('span');
span.innerHTML = "\u00d7";
li.appendChild(span);
}
inputBox.value = "";
saveData();
}
listContainer.addEventListener("click", function(e) {
if (e.target.tagName === "LI") {
e.target.classList.toggle("checked");
saveData();
} else if (e.target.tagName === "SPAN") {
e.target.parentElement.remove();
saveData();
}
}, false);
function saveData()
{
localStorage.setItem("data",listContainer.innerHTML);
}
function showTask(){
listContainer.innerHTML=localStorage.getItem("data");
}
showTask();
</script>
</body>
</html>