Create a pointer trails with Jquery
I am here to demonstrate how you can set a pointer trail on your web-page with the help of Jquery
Its simple - create some img elements having pointer-image in src, and let them follow pointer-position whenever mouse move. And don't forget to fade them out slowly.
The Javascript
$(document).ready(function() {
$(document).mousemove(function(e) {
//create img elements having pointer.png in their src // download it from // http://sites.google.com/site/dharmmotyar/Home/pointer.png pointer = $('<img>').attr({'src':'pointer.png'});
//and append them to document
$(document.body).append(pointer); //show them at mouse position & fade out slowly
pointer.css({
'position':'absolute',
top: e.pageY +2 , //offsets
left: e.pageX +2 //offsets
}).fadeOut(1500);
});});
Demo You can see the working demo by moving your mouse.
Labels: Animation, Javascript, jquery
By : Motyar+ @motyar9 comments
blogbyneha says…
A very interesting journey at your blog indeed. Thanks for the contribution. Look forward to seeing what other little tidbits you have to offer.
Best Wishes,
Neha Sidana
wasim says…
Wasim
says…
.fadeOut(
1500,
function(){$(this).remove();}
);
Derrick says…
If the mouse is moves farther/faster, you need to get rid of the trails much faster as well.
Dharmveer Motyar says…
@wasim thanx for your love.
Fraz Ahmed says…
http://www.techmug.com/jmouse-follower/
தேவைகளற்றவனின் அடிமை says…
says…
says…
I am trying to use the above in Wordpress, however it is not working. The cursor stays the same, but the trail displays that icon that means there is no image?
any ideas of what could be wrong?
thank you


Post a Comment