10 examples of 'jquery vertical scroll div content' in JavaScript

Every line of 'jquery vertical scroll div content' 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
37function doScroll() {
38 var scroll = $(window).scrollTop();
39 var windowHeight = $(window).height();
40 var documentHeight = $(document).height();
41
42 var heightLessScroll = (documentHeight - windowHeight) - scroll;
43
44 if (heightLessScroll <= MINIMUM_HEIGHT_FOR_TO_LOAD) {
45 // $('.show-more').trigger('click');
46 }
47}
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

21function scrollToBottomOfDiv($div) {
22 var scrollHeight = $div[0].scrollHeight;
23 $div.scrollTop(scrollHeight);
24}
20function hasScrolled() {
21 var st = $(this).scrollTop();
22
23 // Make sure they scroll more than delta
24 if (Math.abs(lastScrollTop - st) <= delta) return;
25
26 // If they scrolled down and are past the navbar, add class .nav-up.
27 // This is necessary so you never see what is "behind" the navbar.
28 if (st > lastScrollTop && st > navbarHeight) {
29 // Scroll Down
30 $('header').removeClass('nav-down').addClass('nav-up');
31 } else {
32 // Scroll Up
33 if (st + $(window).height() < $(document).height()) {
34 $('header').removeClass('nav-up').addClass('nav-down');
35 }
36 }
37
38 lastScrollTop = st;
39}
8function scrollNotVisible($container) {
9 return (getScrollHeight($container) - $container.height() - 150 <= 0);
10}
74function scrollToBottom(div_id) {
75 $("#"+div_id).animate({scrollTop: $("#"+div_id)[0].scrollHeight});
76}
87function setScroll (parent, scroll, horizontal) {
88 if (parent === window) {
89 if (horizontal === true) {
90 window.scrollTo(scroll, window.pageYOffset || window.scrollY || document.body.scrollTop || 0)
91 }
92 else {
93 window.scrollTo(window.pageXOffset || window.scrollX || document.body.scrollLeft || 0, scroll)
94 }
95 }
96 else {
97 parent[horizontal === true ? 'scrollLeft' : 'scrollTop'] = scroll
98 }
99}
194function scrollContent(y, isWheel, isJump)
195{
196 //console.log('scrolling');
197 var delta = y;
198
199 var fromTop = parseInt($(me).attr('data-fromtop'));
200 if(!fromTop){
201 fromTop = 0;
202 }
203
204 if (isWheel)
205 {
206 // move bar with mouse wheel
207
208
209 delta = parseInt(fromTop) + y * wheelStep / 100 * me.outerHeight();
210
211 // move bar, make sure it doesn't go out
212 // var maxTop = me.outerHeight() - bar.outerHeight();
213 // delta = Math.min(Math.max(delta, 0), maxTop);
214
215 // scroll the scrollbar
216 // bar.css({ top: delta + 'px' });
217 }
218
219 //percentScroll = parseInt(fromTop) / me.outerHeight();
220 //delta = percentScroll * (me[0].scrollHeight - me.outerHeight());
221
222 if (isJump){
223 delta = y;
224 var offsetTop = delta / me[0].scrollHeight * me.outerHeight();
225 }
226
227 if(delta < 0){
228 delta = 0;
229 }
230 $(me).attr('data-fromtop',delta)
231
232 // scroll content
233 me.scrollTop(delta);
234
235 // ensure bar is visible
236 //showBar();
237
238 // trigger hide when scroll is stopped
239 //hideBar();
240}
3function scroll () {
4 if (window.location.hash === '') return
5 const anchor = $j('a[href="' + window.location.hash + '"]')
6 if (anchor) $j(window).scrollTop(anchor.offset().top)
7}
435public scrollContent(y: number, isWheel: boolean, isJump = false) {
436 this._releaseScroll = false;
437 let delta: number = y;
438 const maxTop: number = this._me.offsetHeight - this._bar.offsetHeight;
439
440 if (isWheel) {
441 // move bar with mouse wheel
442 delta = parseInt(this._bar.style.top, 10) + y * this._options.wheelStep / 100 * this._bar.offsetHeight;
443
444 // move bar, make sure it doesn't go out
445 delta = Math.min(Math.max(delta, 0), maxTop);
446
447 // if scrolling down, make sure a fractional change to the
448 // scroll position isn't rounded away when the scrollbar's CSS is set
449 // this flooring of delta would happened automatically when
450 // bar.css is set below, but we floor here for clarity
451 delta = (y > 0) ? Math.ceil(delta) : Math.floor(delta);
452
453 // scroll the scrollbar
454 this._renderer.setStyle(this._bar, 'top', `${delta}px`);
455 }
456
457 // calculate actual scroll amount
458 this._percentScroll = parseInt(this._bar.style.top, 10) / (this._me.offsetHeight - this._bar.offsetHeight);
459 delta = this._percentScroll * (this._me.scrollHeight - this._me.offsetHeight);
460
461 if (isJump) {
462 delta = y;
463 let offsetTop = delta / this._me.scrollHeight * this._me.offsetHeight;
464 offsetTop = Math.min(Math.max(offsetTop, 0), maxTop);
465 this._renderer.setStyle(this._bar, 'top', `${offsetTop}px`);
466 }
467
468 // scroll content
469 this._me.scrollTop = delta;
470
471 // ensure bar is visible
472 this.showBar();
473
474 // trigger hide when scroll is stopped
475 this.hideBar();
476}
35function scrollDown(){
36 var psconsole = $('#G2_output');
37 psconsole.scrollTop(
38 psconsole[0].scrollHeight - psconsole.height()
39 );
40}

Related snippets