Chrome 5 problem with scroll
$(document).keydown(function (event)
{
if(event.keyCode==38 || event.keyCode==40)
{
var row;
if(event.keyCode==40) row=$(row_selected).next();
if(event.keyCode==38) row=$(row_selected).prev();
if(row.length==0)
{
row=$(row_selected);
}
row_select( row );
var row_position_bottom=$(row).height() +$(row).offset().top;
var doc_position=$(window).height() + $(window).scrollTop();
if(row_position_bottom >doc_position) $(window).scrollTop(row_position_bottom-$(window).height());
if($(row).offset().top < $(window).scrollTop()) $(window).scrollTop($(row).offset().top);
return false;
}
});
Hello i used this code to select row开发者_JS百科s of my table...If the selection isnt visible page scrolls... It works great ,FIrefox,Internet Explorer,Safari, but not in chrome..... In Chrome 4 not the last version it worked great!!!
The problem is that return false doesnt prevent the page from scrolling...
try to call:
event.preventDefault();
event.stopPropagation();
return(false);
ALL three.
精彩评论