NameSilo

JS Scroll detecting Cross browser

SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
Namecheap AuctionsNamecheap Auctions
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

A browser tab with a favicon next to the page title
Search members
You can now search for members by name, company, location and more. Open the search at the top of any page and choose Members. You will...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back