Hi guys, I want to make a gallery which scrolls left and right depending on the mouse position. So you move the mouse right and the gallery scrolls left sort of thing.
Thanks,
Henry.
Hi guys, I want to make a gallery which scrolls left and right depending on the mouse position. So you move the mouse right and the gallery scrolls left sort of thing.
Thanks,
Henry.
I think this shouldn't be too hard. If you set up a scrolling area to contain the image you can move this left and right using function animate. Then you can get the position of the mouse in relation to the div you want to scroll and caluclate how much you want it to move depending on where the mouse is. This doesn't do what you want but is does something similar:
$().mousemove( function(e) {
var pos = $("#holder").offset()
mouseX = e.pageX - pos.left;
mouseY = e.pageY - pos.right;
if(mouseX > 332 || mouseY > 528 || mouseX < 0 || mouseY < 0) return false;
posx = Math.round(mouseX/10)*332;
posy = Math.round(mouseY/10)*10;
$("#holder").css({'backgroundPosition': posx+'px 0'});
});