Every line of 'jquery scroll to top' 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.
38 scrollToTop() { 39 $('html, body').animate({ 40 scrollTop: 0, 41 }, 500); 42 }
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
16 scrollToTop() { 17 $('#scroll-top').on('click', function(e) { 18 19 if( e ) { 20 e.preventDefault(); 21 e.stopPropagation(); 22 } 23 24 $('html,body').animate( { scrollTop: 0 }, 750 ); 25 return false; 26 }); 27 }
53 scrollToTop(topOffset = 0) { 54 this.scrollToElement(this.doc.body, topOffset); 55 }
3 function 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 }
36 function scroll_to(delta) { 37 38 if (delta < 0 ) { 39 40 delta = -scrollinc; 41 } else { 42 43 delta = scrollinc; 44 } 45 46 delta = delta * deltaKoef; 47 48 var listWidth = scroller.find('.dslca-section-scroller-content').width(); 49 var contentWidth = scroller.width(); 50 51 if ( listWidth <= contentWidth ) return false; 52 53 var scrollMax = listWidth - contentWidth + 10; 54 55 delta = parseInt(scrollInner.style.left || 0) - delta; 56 delta = delta >= 0 ? 0 : delta; 57 delta = delta <= -scrollMax ? -scrollMax : delta; 58 59 scrollInner.style.left = delta + 'px'; 60 }
424 scrollToTop(scrollDuration) { 425 if (!isBrowser) return; 426 427 const scrollHeight = window.scrollY; 428 const scrollStep = Math.PI / (scrollDuration / 15); 429 const cosParameter = scrollHeight / 2; 430 431 let scrollCount = 0; 432 let scrollMargin; 433 const scrollInterval = setInterval(() => { 434 if (window.scrollY > this.relativeTop) { 435 scrollCount += 1; 436 scrollMargin = 437 cosParameter - cosParameter * Math.cos(scrollCount * scrollStep); 438 window.scrollTo(0, scrollHeight - scrollMargin); 439 } else { 440 clearInterval(scrollInterval); 441 } 442 }, 16); 443 }
37 function 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 }
55 onScroll(top) { 56 57 this.top = top; 58 59 // if we're past threshold, 60 // or at bottom of document 61 // show el 62 if (this.top >= this.threshold + this.offset || this.top >= this.docH - this.windowH) { 63 64 this.show(this.el); 65 66 } else { 67 68 this.hide(this.el); 69 70 } 71 72 }
51 scrollToTop: function scrollToTop() { 52 $('html, body').animate({ 53 scrollTop: $("body").offset().top - 0 54 }, 0); 55 },
24 scrollToTop(): void { 25 this.$scrollTo.goToTop(this.speed); 26 }