Quick jQuery "Back to Top"
by allen1
HTML
<div id="sketch"></div>
<div id="sketch1"></div>
<div id="sketch2"></div>
<div id="sketch3"></div>
<div class="follow" id="myid"> Following mouse pointer</div>
CSS
#sketch {
width: 200px;
height: 200px;
border: 1px solid gray;
background: brown;
float:left;
}
#sketch1 {
width: 200px;
height: 200px;
border: 1px solid gray;
background: green;
float:left;
}
#sketch2 {
width: 200px;
height: 200px;
border: 1px solid gray;
background: pink;
float:left;
}
#sketch3 {
width: 200px;
height: 200px;
border: 1px solid gray;
background: black;
float:left;
}
#myid {
position: absolute;
z-index: 1000;
}
JavaScript
$("div").mousemove(function(e){
$('.follow').css({'top': e.clientY - 20, 'left': e.clientX - 20});
});
$("div").mouseover(function() {
var col=$(this).css("background-color");
$("#myid").css("background-color",col);
});