Hi, i found a bug where Effect.scrollTo scrolls to the top of the page instead of scrolling to the item on the page.
The problem appears because the following code on line 514 (1.8.0) returns an invalid height in firefox 2. (in my case 810 in stead of 2120 pixels).
max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();
I did manage to create my own solution BUT it's not really the best way and also not implemented into the prototype. So my solution needs to be properly processed into the code.
Effect.ScrollTo = function(element) {
var options = arguments[1] || { },
scrollOffsets = document.viewport.getScrollOffsets(),
elementOffsets = $(element).cumulativeOffset(),
max = getBrowserHeight() - document.viewport.getHeight();
if (options.offset) elementOffsets[1] += options.offset;
return new Effect.Tween(null,
scrollOffsets.top,
elementOffsets[1] > max ? max : elementOffsets[1],
options,
function(p){ scrollTo(scrollOffsets.left, p.round()) }
);
};
getBrowserHeight = function(){
if( window.innerHeight && window.scrollMaxY ){ // Firefox
pageHeight = window.innerHeight + window.scrollMaxY;
}else if( document.body.scrollHeight > document.body.offsetHeight ) // all but Explorer Mac
{
pageHeight = document.body.scrollHeight;
}else{ // works in Explorer 6 Strict, Mozilla (not FF) and Safari
pageHeight = document.body.offsetHeight + document.body.offsetTop;
}
return pageHeight;
},