Mousemove function
by Alin Guta
HTML
<div id="activate"></div>
<div id="tail"></div>
CSS
#activate {
width:100%;
height:50px;
position:relative;
margin:0;
padding:0;
background:#e2e2e2;
}
#tail {
position: absolute;
float: left;
top:200px;
width:20px;
height:20px;
background:#7FCAAB;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
-o-transition: all .5s;
-ms-transition: all .5s;
-moz-transition: all .5s;
-webkit-transition: all .5s;
transition: all .5s;
}
JavaScript
$('#activate').hover(function () {
$(this).bind('mousemove', function (e) {
$('#tail').css({
left: e.pageX - 10
});
});
});