Set value in scrolltop

Asked

Viewed 46 times

0

How do I set a new value in scrolltop, instead of it being 0, be for example a number 'x'.

this.liveScroller.dom.scrollTop = 563;

1 answer

0

The scrollTop method works on all modern browsers:

Scroll Top

Example:

Javascript

Scroll Top Window:

window.scrollY

Scroll Top of an element:

document.getElementsByTagName('div')[0].scrollTop

jQuery

Scroll Top Window:

jQuery(window).scrollTop();

Scroll Top of an element:

jQuery('#teste').scrollTop();
  • I wanted to set the scrolltop to start with this value instead of 0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.