Dynadot โ€” .com Transfer

JS Scroll detecting Cross browser

SpaceshipSpaceship
Watch

crazyluv

Established Member
Impact
2
I am use the following javascript code to detect the scroll movement in various browsers. Mostly IE and FF since those are the only two I got.

Code:
function getScrollMovement(){
	if (typeof(pageXOffset) != "undefined")
	{
		currentX=window.pageXOffset;
		currentY=window.pageYOffset;
	}
	else if (document.compatMode == "CSS1Compat" )
	{
		currentX=document.documentElement.scrollLeft
		currentY=document.documentElement.scrollTop
	}
	else
	{
		currentX=document.body.scrollLeft
		currentY=document.body.scrollTop
	}
}

I was wondering if this code is compatible in other browsers and for most version of the two I have already mentioned.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back