manna
manna

Reputation: 131

get top position of the web page using javascript

Trying to take position of the top (window top x=0 and y=0) visible part of the web page.

Please see this image

enter image description here

Upvotes: 3

Views: 1147

Answers (2)

immayankmodi
immayankmodi

Reputation: 8580

Common:

var X - $(window).screenX();
var Y - $(window).screenY();

IE:

var X = $(window).screenLeft();
var Y - $(window).screenTop();

Hope it helps you!

Upvotes: 2

Milind Anantwar
Milind Anantwar

Reputation: 82231

You need:

 $(window).scrollTop();

Using Javascript:

 document.documentElement.scrollTop  ||  window.pageYOffset

Working Fiddle

Upvotes: 9

Related Questions