khananzar / My-Project

0 stars 0 forks source link

ToDo List #3

Open khananzar opened 2 months ago

khananzar commented 2 months ago

<!DOCTYPE html>

To Do List App

To-Do List

khananzar commented 2 months ago

*{ margin: 0; padding: 0; font-family: 'Poppins', sans-serif; box-sizing: border-box; }

/ nav bar /

.navcontainer{ display: flex; flex-direction: row; height: 10vh; width: 100%; margin: 0 auto; padding: 0 50px; background: linear-gradient(135deg, #4c80e8, #185f08);

}

.nav-logo{ display: flex; align-items: center; gap: 1;

} .nav-logo img{ height: 35px; width: 35px; } .nav-logo p{ font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 20px; font-weight: 500; cursor: default; }

.app{ display: flex;

margin: 22px;
font-size: 20px;   

} .app a{ text-decoration: none; margin: 0px 20px 0px 0; margin-left: 280px; display: flex;

}

/ other work / .container{ width: 100%; min-height: 100vh; background: linear-gradient(135deg, #153677, #4e085f); padding: 10px; } .todo-app{ width: 100%; max-width: 540px; background: #fff; margin: 100px auto 20px; padding: 40px 30px 70px; border-radius: 10px; }

/ .todo-app img{ height: 100px; width: 80px; } /

.todo-app h2{ color: #002765; display: flex; align-items: center; margin-bottom: 20px; } .todo-app h2 img{ width: 30px; margin-left: 10px; }

.row{ display: flex; align-items: center; justify-content: space-between; background: #edeef0; border-radius: 30px; padding-left: 20px; margin-bottom: 25px; }

input{ flex: 1; border: none; outline: none; background: transparent; padding: 10px; font-weight: 14px; }

button{ border: none; outline: none; padding: 16px 50px; background: #ff5945; color: #fff; font-size: 16px; cursor: pointer; border-radius: 40px; }

ul li{ list-style: none; font-size: 20px; padding: 12px 8px 12px 50px; user-select: none; cursor: pointer; position: relative; }

ul li::before{ content: ''; position: absolute; height: 28px; width: 28px; border-radius: 50%; background-image: url('uncheck.png'); background-size: cover; background-position: center; top: 12px; left: 8px;

}

ul li.checked{ color: #555; text-decoration: line-through; }

ul li.checked::before{ background-image: url('checked.png'); }

ul li span{ position: absolute; right: 0; top: 5px; width: 40px; height: 40px; font-size: 22px; color: #555; line-height: 40px; text-align: center; border-radius: 50%;

} ul li span:hover{ background: #edeef0; }

@media(max-width:933px){ .navcontainer{ display: flex; } } @media(max-width:922px){ .navcontainer{ display: block; width: 100%; } .app a{ text-decoration: none; margin: 0px 5px 0px 0; margin-left: 20px; display: block;

} .container{ display: block; width: 100%; } }

@media(max-width:900px){ .navcontainer{ display: block; align-items: center; justify-content: space-evenly; }

.app a{
    text-decoration: none;
    margin: 0px 5px 0px 0;
    margin-left: 20px;
    display: block;
}

.container{
    display: block;
    width: 100%;

}

.todo-app{
    width: 100%;
    display: block;
    border-radius: 10px;
}

}

@media(max-width:344px){ .navcontainer{ display: block; align-items: center; justify-content: space-evenly; } .app a{ text-decoration: none; margin: 0px 5px 0px 0; margin-left: 20px; display: block; }

.container{
    display: block;
    width: 100%;

}

.todo-app{
    width: 260px;
    display: block;
    border-radius: 10px;
}
button{
    display: block;
    padding: 16px 15px;
}
input{
    width: 20px;
}

}

@media(max-width:375px){ .navcontainer{ display: block; align-items: center; justify-content: space-between; width: 100%;

}
.app{
    display: block;

    margin: 2px;
    font-size: 2px;   
}

.app a{
    text-decoration: none;
    margin: 5px;
    display: block;
    font-size: 2px;
}

.nav-logo{
    font-size: 2px;
}
.container{
    display: block;
    width: 100%;

}

.todo-app{
    width: 260px;
    display: block;
    border-radius: 10px;
}
button{
    display: block;
    width: 10px;
    padding: 7px 5px;
}
input{
    width: 10px;
}

}

khananzar commented 2 months ago

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 = "";

}

listContainer.addEventListener("click",function(e){ console.log(e) if(e.target.tagName === "LI"){ e.target.classList.toggle("checked");

}
else if(e.target.tagName === "SPAN"){
    e.target.parentElement.remove();

}

},false);