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

many changes commited #6

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
13 changes: 13 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ for (i = 0; i < myNodelist.length; i++) {
myNodelist[i].appendChild(span);
}


function setFocus(){
document.getElementById("myInput").focus();
}
// Click on a close button to hide the current list item
var close = document.getElementsByClassName("close");
var i;
Expand All @@ -19,13 +23,22 @@ for (i = 0; i < close.length; i++) {
}
}



// Add a "checked" symbol when clicking on a list item
var list = document.querySelector('ul');
list.addEventListener('click', function(ev) {
if (ev.target.tagName === 'LI') {
ev.target.classList.toggle('checked');
}
}, false);
list.addEventListener('keypress', function(ev) {
if(ev.key==='enter'){
if (ev.target.tagName === 'LI') {
ev.target.classList.toggle('checked');
}
}
}, false);

// Create a new list item when clicking on the "Add" button
function newElement() {
Expand Down
8 changes: 5 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
<link rel="stylesheet" href="./styles.css" type="text/css" />
</head>
<body>
<div id="myDIV" class="header">
<div id="myDIV" class="header" onchange="newElement()">
<h2>My To Do List</h2>
<input type="text" id="myInput" placeholder="Title..." />
<span onclick="newElement()" class="addBtn">Add</span>
<div class="button">
<input type="text" id="myInput" placeholder="Title..." />
<span class="addBtn">Add</span>
</div>
</div>

<ul id="myUL">
Expand Down
30 changes: 25 additions & 5 deletions styles.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400&family=Outfit:wght@100;200;300;400;500;600;700;800;900&family=Poppins:wght@100;200;300;400;500;700;800;900&family=Raleway:wght@100;200;300;400;500;600;700;800;900&display=swap');
/* Include the padding and border in an element's total width and height */
* {
box-sizing: border-box;
padding: 0;
margin: 0;
font-family: 'Poppins',sans-serif;
}

/* Remove margins and padding from the list */
ul {
margin: 0;
margin: auto;
max-width: 1000px;
list-style-type: none;
padding: 0;
}

/* Style the list items */
ul li {
cursor: pointer;
position: relative;

padding: 12px 8px 12px 40px;
background: #eee;
font-size: 18px;
Expand Down Expand Up @@ -71,10 +78,20 @@ ul li.checked::before {

/* Style the header */
.header {
background-color: #63ae35;
padding: 30px 40px;
background: linear-gradient(90deg, rgba(149,61,203,1) 19%, rgba(203,61,95,1) 41%, rgba(255,179,0,1) 77%);;
padding: 50px 0px;
color: white;
text-align: center;
padding-bottom:70px ;
}

.header h2{
padding: 20px 0;
}

div .button{
margin:auto;
max-width: 1000px;
}

/* Clear floats after the header */
Expand All @@ -86,15 +103,18 @@ ul li.checked::before {

/* Style the input */
input {
margin: 0;
border: none;
border-radius: 0;
width: 75%;
padding: 10px;
float: left;
font-size: 16px;
autofocus:true;
}
input:focus{
outline: none;

}

/* Style the "Add" button */
.addBtn {
padding: 10px;
Expand Down