Created
October 22, 2015 23:44
-
-
Save kevincolten/6386aacd259ea881cff7 to your computer and use it in GitHub Desktop.
Todo App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title></title> | |
<link rel="stylesheet" href="style.css" /> | |
</head> | |
<body> | |
<div id="content"> | |
<div class="header">TODO</div> | |
<form> | |
<input type="text" id="todo"> | |
<input type="submit" value="Submit"> | |
</form> | |
<ul id="todo-list"> | |
<li>Walk the dog</li> | |
</ul> | |
</div> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"></script> | |
<script type="text/javascript" src="./Todo.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*:focus { | |
outline-style: none !important; | |
outline: 0 !important; | |
} | |
#content { | |
margin: 0 auto; | |
width: 100%; | |
max-width: 400px | |
} | |
.header { | |
text-align: center; | |
margin: 20px; | |
font-size: 40px; | |
} | |
#todo-list { | |
margin: 20px 0; | |
padding: 0; | |
} | |
form { | |
text-align: center; | |
} | |
#todo-list li { | |
display: table; | |
margin: 10px auto; | |
width: 75%; | |
padding: 10px 0; | |
border: 1px solid #ccc; | |
-webkit-border-radius: 5px; | |
border-radius: 5px; | |
text-align: center; | |
background-color: #fdfdfd; | |
} | |
#todo-list li span { | |
text-align: right; | |
} | |
input[type="submit"] { | |
padding:5px 0; | |
text-align: center; | |
background:#ccc; | |
border: 0 none; | |
-webkit-border-radius: 0px; | |
border-radius: 0px; | |
font-size: 14px; | |
width: 20%; | |
} | |
input[type=text] { | |
padding:6px; | |
border:1px solid #ccc; | |
-webkit-border-radius: 0px; | |
border-radius: 0px; | |
width: 65%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
$(document).ready(function() { | |
$('form').on('submit', function (e) { | |
e.preventDefault(); | |
var todoText = $(this).find('#todo').val(); | |
createTodo(todoText); | |
$(this).find('#todo').val(''); | |
}); | |
function createTodo(todoText) { | |
var todo = '<li>' + todoText + '</li>'; | |
$('#todo-list').append(todo); | |
} | |
$('#todo-list').sortable(); | |
FastClick.attach(document.body); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment