All pastes #919784 Raw Edit

Unnamed

public javascript v1 · immutable
#919784 ·published 2008-02-27 00:04 UTC
rendered paste body
/**  * Try this, see if it does what you're looking for...  */function updateHeight () {  var y, _y = 1000, d=document.getElementsByTagName("body")[0];  if (d.scrollHeight - d.scrollTop <= 1000)     alert("not much more scroll to go!\n"+(d.scrollHeight - d.scrollTop)+"px left");}getPageHeight() appears to be working incorrectly. It is reporting a max of 686, while the getScrollHeight() is reporting in the thousands (appears correct). If getPageHeight() is just reporting the viewable area, how might i get it to report the *actual* page height.// These two functions are based on code from// http://www.quirksmode.org/viewport/compatibility.htmlfunction getPageHeight(){	var y;	var test1 = document.body.scrollHeight;	var test2 = document.body.offsetHeight;	if (test1 > test2) { // all but Explorer Mac		y = document.body.scrollHeight;	} else { // Explorer Mac; would also work in Explorer 6 Strict, Mozilla and Safari		y = document.body.offsetHeight;	}	return parseInt(y);}function _getWindowHeight(){	if(self.innerWidth) {		frameWidth = self.innerWidth;		frameHeight = self.innerHeight;	} else if (document.documentElement && document.documentElement.clientWidth) {		frameWidth = document.documentElement.clientWidth;		frameHeight = document.documentElement.clientHeight;	} else if (document.body) {		frameWidth = document.body.clientWidth;		frameHeight = document.body.clientHeight;	}return parseInt(frameHeight);}function getScrollHeight(){	var y;	// all except Explorer	if(self.pageYOffset) {		y = self.pageYOffset;	} else if (document.documentElement && document.documentElement.scrollTop) {		y = document.documentElement.scrollTop;	} else if (document.body) { // all other Explorers		y = document.body.scrollTop;	}	return parseInt(y)+_getWindowHeight();}