If you want to "guess" the maximum scrolltop value, maybe you should compare the height of the document and the viewport height (size of your window).
/**
* Return a viewport object (width and height)
*/
function viewport()
{
var e = window, a = 'inner';
if (!('innerWidth' in window))
{
a = 'client';
e = document.documentElement || document.body;
}
return { width : e[ a+'Width' ] , height : e[ a+'Height' ] }
}
// Retrieve the height of the document, including padding, margin and border
var documentHeight = $(document).outerheight(true);
var viewPortData = viewport();
var maxScrollTop = documentHeight - viewPortData.height;
Of course, in your plugin, you should also add a listener on the resize event, and re-calculate the maximum scrollTop.