Skip to content

Instantly share code, notes, and snippets.

@gcr
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gcr/9853918 to your computer and use it in GitHub Desktop.
Save gcr/9853918 to your computer and use it in GitHub Desktop.
<!doctype:html>
<style>
#target {
background-color: #800;
display: inline-block;
position: absolute;
padding: 0.5em;
border-radius: 0.3em;
color: #fff;
}
</style>
<span id="target">Try to click me!</span>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$("#target").on("mouseover", function(){
// Move the target out of the way, heehee
$("#target").animate({
top: 500*Math.random(),
left: 500*Math.random()
}, 300);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment