I've created a 16x16 grid. If you hover your mouse over a box, the box will turn pink. When you leave the box, the entire box disappears. I would like to make it so when you leave the box, the entire box stays intact, except the pink color fades away and is replaced with the original gray color after a second or so.
HTML:
<head>
<title>SketchPad</title>
<link rel="stylesheet" type="text/css" href="style.css" >
</head>
<body>
<h1> SketchPad </h1>
<div id="container">
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="jquery.js"></script>
</body>
</html>
CSS:
h1 {
text-align: center;
color: black;
}
tr, td, table {
border-style: solid;
border-width: 1px;
background-color: gray;
margin: auto;
height: 25px;
width: 525px;
}
JS:
var rows=16;
var cols=16;
document.write("<table>");
for (i=0; i<rows; i++) {
document.write("<tr>");
for (j=0; j<cols; j++) {
document.write("<td>"+"</td>");
}
document.write("</tr>");
}
document.write("</table>");
$( "td").css("color", "red");
$("td").hover(function() {
$(this).css("background-color", "pink");
}, function () {
$(this).fadeOut("slow", function(){
});
});