Skip to content

Instantly share code, notes, and snippets.

@joe-watkins
Created February 17, 2014 19:47
Show Gist options
  • Save joe-watkins/9057599 to your computer and use it in GitHub Desktop.
Save joe-watkins/9057599 to your computer and use it in GitHub Desktop.
A Pen by Joe Watkins.
<h1>Watch the needy kitty follow your mouse</h1>
<div id="canvas">
<div class="kitty"></div>
</div>
var $pointer = $(".kitty");
canvas.addEventListener('mousemove', function(e) {
setTimeout(function() {
$pointer.css('top',e.offsetY+50).css('left',e.offsetX+50).show();
}, 300);
});
@import "compass";
#canvas,html,body {
width:100%;
height:100%;
position:relative;
}
h1 {
position:absolute;
top:10px;
left:10px;
}
.kitty {
position: absolute;
left:-9999em;
top:-9999em;
width:100px;
height:100px;
border-radius:100px;
z-index:5;
background:white;
background-image:url('http://placekitten.com/100/100');
display:none;
box-shadow:3px 3px 3px #666;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment