Problem with automatic vertical scroll with mousemove
I'm trying to apply this:
http://valums.com/wp-content/uploads/20 ... /final.htm
in a div with text only, but something is wrong. My divs have 300px of max-height, with overflow-y enabled. My Jquery code to apply this idea is:
-
$(document).ready(function() {
$('#produto_acoes').mousemove(function(e){divsmouseover(e,'produto_acoes',this.offsetTop);});
$('#produto_opcoes').mousemove(function(e){divsmouseover(e,'produto_opcoes',this.offsetTop);});
$('#produto_termo').mousemove(function(e){divsmouseover(e,'produto_termo',this.offsetTop);});
$('#produto_aluguel').mousemove(function(e){divsmouseover(e,'produto_aluguel',this.offsetTop);});
});
function divsmouseover(e,id,oft){
var e = e ? e : window.event;
var y = (e.pageY - oft + 1)-207; // mouse y position on div, don`t ask me why 207... but it works!
var anda = ((($('#'+id)[0].scrollHeight)-(300))/300)*y; //the new scroll position on div
$('#'+id).animate({scrollTop: anda},"fast"); //set the position
return false;
}
but what happen you can see here:
http://www.percap.com.br/index3.html
click on "Produtos" and then on "Mercado de Acoes" or "Mercado de Opcoes". I don't understand why this happens...