Adding "easing" to cool function
Hi guys and gals!
I'm totally new to jQuery. Moved on to it from MooTools today just because I want to figure it out before it's being released with ASP.NET.
I'm making a menu with thumbnails that kinda "follows the mouse". You can see it at
http://test.lightboxone.se.
I would like to add some easing, smooth effect, to the "mover" but I have absolutely no idea how I'm afraid so now I'm turning to you. If I add the effect directly in to the function, well ... It breaks it.
The code for the "mover" itself is:
-
$().mousemove(function(e) {
if (e.pageY <= 200)
{
var docWidth = $(document).width();
var cursX = e.pageX - ($(document).width() / 2);
var elWidth = $('#mover').width();
// This is where I set the position of the "mover"
var negCursX = (((-cursX * (elWidth / docWidth)) + (docWidth / 2)) - (elWidth / 2));
$('#mover').css('left', negCursX);
$('#mx').val(e.pageX);
$('#my').val(e.pageY);
$('#thevalue').val($('#mover').css('left'));
}
});
I hope you guys can understand what the code is doing.
The full code is available through right-click on
http://test.lightboxone.se
It would be so cool if you could help me. I think it's a rather cool effect that I'm borrowing form an old flash project I made ages ago.
Thank you all in advance.
Regards,
Fredrik Sundström