Created
April 24, 2017 01:23
-
-
Save sarahzinger/0ffc19cee9ffce38c89c607b94a01b57 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=0ffc19cee9ffce38c89c607b94a01b57
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> | |
<head> | |
<title>Page Title</title> | |
</head> | |
<body> | |
<div id="button">I predict your favorite number is...</div> | |
<div id="fav-number"></div> | |
</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
{"enabledLibraries":["jquery"]} |
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
$("#button").click(function() { | |
var someNumberBtwZeroAndOne = Math.random(); | |
var someNumberBtwZeroAndOneTimes5 = someNumberBtwZeroAndOne * 5; | |
var someNumberBtwZeroAndOneTimes5Rounded = Math.floor(someNumberBtwZeroAndOneTimes5); | |
var yourFavNumber = someNumberBtwZeroAndOneTimes5Rounded + 1; | |
$("#fav-number").html(yourFavNumber); | |
}); |
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
#button { | |
background-color: #41f453; | |
cursor: pointer; | |
padding: 10px; | |
border-radius: 5px; | |
} | |
#fav-number { | |
text-align: center; | |
font-size: 150px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment