I want to automatically scroll a div based on mouse position using jQuery.
If you see this fiddle here, you can see a number of images that are horizontally ordered in a
this should at least get you headed in the right direction.
var parent = $('#parent'); var img = $('img:first-child'); parent.on('mousemove', function(e) { mouseX = e.pageX img.css('margin-left',-mouseX/parent.width()*100); });
http://jsfiddle.net/xWcXt/4/