-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/*Copyright Jason McKee 2017 All rights reserved. */ | ||
#container{ | ||
height: 480px; | ||
width: 480px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
float:left; | ||
} | ||
div { | ||
border: 1px dashed gray; | ||
} | ||
#reset-button{ | ||
float:left; | ||
margin-left: 20px; | ||
margin-top: 100px; | ||
font-size: 18px; | ||
font-family: arial,sans-serif; | ||
background-color: #eeeeee; | ||
color:gray; | ||
border-radius:3px; | ||
} | ||
#reset-button:hover { | ||
color:black; | ||
} | ||
#reset-button:focus { | ||
box-shadow:none; | ||
outline-style:none; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<html> | ||
<head> | ||
<title>Sketch Pad</title> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> | ||
<script src="js/sketchpad.js"></script> | ||
<link rel="stylesheet" href="css/sketchpad.css"> | ||
</head> | ||
<body> | ||
<div id="container"> | ||
|
||
</div> | ||
<input type="button" id="reset-button" value="Reset"> </input> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//Copyright Jason McKee 2017. All rights reserved. | ||
var width = 16; | ||
var widthpx = 480; | ||
var borderWidth = 1; | ||
|
||
function setup(width, widthpx, borderWidth) { | ||
for (var i = 0; i < width; i++ ) { | ||
for (var j = 0; j < width; j++) { | ||
blockID="u-"+i+"-"+j; | ||
$("#container").append( | ||
"<div class=\'unit-block\' id=\'"+ blockID + "\'></div>"); | ||
blockID = "#" + blockID; | ||
$(blockID).css('display','inline'); | ||
$(blockID).css('margin','0'); | ||
$(blockID).css('padding','0'); | ||
unitWidth = (widthpx / width) - (2*borderWidth); | ||
$(blockID).css('height',unitWidth +'px'); | ||
$(blockID).css('width',unitWidth +'px'); | ||
|
||
if (j === 0) { | ||
$(blockID).css('float','left'); | ||
} | ||
|
||
else { | ||
$(blockID).css('float', 'right'); | ||
} | ||
} | ||
} | ||
} | ||
$(document).ready(function() { | ||
|
||
setup(width,widthpx, borderWidth); | ||
|
||
$(".unit-block").hover( function() { | ||
$(this).css('background-color',"#000000") | ||
}); | ||
|
||
|
||
$("#reset-button").on('click', function() { | ||
var newWidth = prompt('Please enter the width you would like', width); | ||
width = newWidth; | ||
|
||
}); | ||
|
||
}); |