/index.html Secret
Last active
March 23, 2017 11:13
gist test on bl.ocks.org
This file contains hidden or 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"> | |
<title>bl.ocks.org rendering test</title> | |
<script src="http://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
</head> | |
<body> | |
<div class="ball"></div> | |
<script type="text/javascript"> | |
window.jQuery || document.write("<script src=\"http://code.jquery.com/jquery-2.2.4.min.js\" integrity=\"sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=\" crossorigin=\"anonymous\"><\/script>"); | |
</script> | |
<script type="text/javascript" src="script.js"></script> | |
</body> | |
</html> |
This file contains hidden or 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
$(document).ready(function() { | |
$('.ball').click(function() { | |
console.log(this.className); | |
$(this).toggleClass('paused'); | |
}); | |
$(window).load(function() { | |
alert('click the ball to control the running state.'); | |
}); | |
}); |
This file contains hidden or 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
/* Reset */ | |
* { | |
margin: 0; | |
padding: 0; | |
} | |
html, body { | |
height: 100%; | |
} | |
/* Animation */ | |
.ball { | |
width: 50px; | |
height: 50px; | |
position: absolute; | |
top: 0; | |
left: 0; | |
z-index: 99; | |
border-radius: 50%; | |
background: #fa0; | |
transition: background 1s ease; | |
animation: 7s 0s xmove, 5s 0s ymove; | |
animation-timing-function: linear; | |
animation-iteration-count: infinite; | |
animation-direction: alternate; | |
} | |
@keyframes xmove { | |
0% {left: 0;} | |
100% {left: calc(100% - 50px);} | |
} | |
@keyframes ymove { | |
0% {top: 0;} | |
100% {top: calc(100% - 50px);} | |
} | |
.ball:hover { | |
background: #1af; | |
} | |
.paused{ | |
animation-play-state: paused; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment