D
D
DeusModus2011-06-30 11:56:21
JavaScript
DeusModus, 2011-06-30 11:56:21

Remembering the scroll position in the browser?

Hello.
Browsers are getting smarter and smarter. If you look at half the page and then refresh it, the focus will remain on what you have not read. And that's great.
Does anyone know what this is called and is it possible to see it in js?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
NikoB, 2011-06-30
@DeusModus

function getBodyScrollTop()
{
return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}

returns the number of pixels on the page that are not visible from above.

I
int02h, 2011-06-30
@int02h

The Window object has scrollBy() and scrollTo() methods. Isn't it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question