10 examples of 'react scrolltop' in JavaScript

Every line of 'react scrolltop' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
39get scrollTop(): number {
40 return this.nativeElement.scrollTop;
41}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

42@action setScrollTop(value) {
43 this.scrollTop = value
44}
112get _scrollTop() {
113 return this['scroll-top'];
114}
157onChangeScrollTop(value){
158 if (this.props.onChangeScrollTop){
159 const height =
160 this.editor.getSession().getDocument().getLength() *
161 this.editor.renderer.lineHeight;
162 this.props.onChangeScrollTop(value / height);
163 }
164}
120scrollTop(value) {
121 if (arguments.length) {
122 this.getElementsCore('body')
123 .forEach(element => element.scrollTop = value);
124
125 return;
126 }
127
128 return this.getElement().scrollTop;
129}
106scrollTop(value) {
107 if (arguments.length) {
108 this.getElementsCore('body')
109 .forEach(element => element.scrollTop = value);
110 }
111
112 return this.getElement().scrollTop;
113}
72get scrollTop() {
73 if (!this.content) { return 0; }
74
75 return this.content.scrollTop;
76}
95static getScrollTop() {
96 if (typeof(window.pageYOffset) === 'number') {
97 return window.pageYOffset;
98 } else if (document.body && document.body.scrollTop) {
99 return document.body.scrollTop;
100 } else if (document.documentElement && document.documentElement.scrollTop) {
101 return document.documentElement.scrollTop;
102 }
103
104 throw new Error('Unable to determine scrollTop of the window');
105}
164scrollTop(value) {
165 if (!arguments.length) {
166 return this.element.scrollTop;
167 }
168
169 this.element.scrollTop = value;
170}
81public setScrollTop(scrollTop: number): void {
82 this._domNode.scrollTop = scrollTop;
83}

Related snippets