10 examples of 'javascript scrolltop div' in JavaScript

Every line of 'javascript scrolltop div' 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
21function scrollToBottomOfDiv($div) {
22 var scrollHeight = $div[0].scrollHeight;
23 $div.scrollTop(scrollHeight);
24}
47function scrollTop() {
48 var btn = document.getElementById("js_back_to_top");
49 var timer;
50 var isTop;
51
52 function handleScrollEvent() {
53 var osTop = document.documentElement.scrollTop || document.body.scrollTop;
54
55 if ( osTop >= 30 ) {
56 btn.className = 'show';
57 } else {
58 btn.className = 'hide';
59 }
60 }
61
62 EventUtil.addHandler(window, 'scroll', function() {
63 throttle(handleScrollEvent);
64
65 if ( !isTop ) {
66 clearTimeout(timer);
67 }
68 isTop = false;
69 });
70
71 function scroll() {
72 var osTop = document.documentElement.scrollTop || document.body.scrollTop;
73 var speed = Math.ceil(osTop / 13);
74
75 document.documentElement.scrollTop = document.body.scrollTop = osTop - speed;
76
77 isTop = true;
78
79 if ( osTop > 0 ) {
80 timer = setTimeout(scroll, 30);
81 }
82 }
83
84 EventUtil.addHandler(btn, 'click', function(event) {
85 event = EventUtil.getEvent(event);
86 EventUtil.preventDefault(event);
87
88 timer = setTimeout(scroll, 30);
89 });
90}
74function scrollToBottom(div_id) {
75 $("#"+div_id).animate({scrollTop: $("#"+div_id)[0].scrollHeight});
76}
5function getScrollTop() {
6 return (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
7}
492function findScrollTop() {
493 if (!glbl.$scrollTopNode) {
494 if (glbl.$html.scrollTop() != 0) {
495 glbl.$scrollTopNode = glbl.$html
496 } else if (glbl.$body.scrollTop() != 0) {
497 glbl.$scrollTopNode = glbl.$body
498 }
499 }
500 return (glbl.$scrollTopNode) ? glbl.$scrollTopNode.scrollTop() : 0
501}
125updateScrollTop(scrollTop) {
126 this.scrollTop = scrollTop
127
128 this.itemsPerRow = calculateItemsPerRow(this.displayWidth, this.itemWidth, this.paddingLeft)
129 this.minVisibleIndex = calculateMinVisibleIndex(scrollTop, this.itemHeight, this.itemsPerRow, this.paddingTop)
130 this.maxVisibleIndex = calculateMaxVisibleIndex(this.displayHeight, this.itemHeight, this.itemsPerRow, this.minVisibleIndex, this.buffer)
131 this.offsetTop = calculateOffsetTop(this.minVisibleIndex, this.itemsPerRow, this.itemHeight, this.paddingTop)
132}
197scrollTop() {
198 this.vGridGenerator.scrollTop();
199}
159function getScrollHeight(elementID) {
160 var height = 0;
161 var children = d3.select("#" + _this.table_name + "Table tbody").node().children;
162 for (var i = 1; i < children.length; i++) { // the first child is always the header
163 if (children[i].id === elementID) {
164 return height;
165 }
166 height += children[i].scrollHeight;
167 }
168 return height;
169}
4function getScrollTop (scrollTop = 0, bodyScrollTop = 0, documentScrollTop = 0) {
5 scrollTop = document.querySelector(selector).scrollTop
6 return scrollTop
7}
73private _getScrollTop(): number | undefined {
74 if (!this.props.navScrollerId) {
75 return undefined;
76 }
77
78 const navScroller = document.getElementById(this.props.navScrollerId) as HTMLElement;
79
80 if (navScroller && navScroller.scrollTop > 0) {
81 return navScroller.scrollTop;
82 }
83
84 return undefined;
85}

Related snippets