Every line of 'smoothscroll.js demo' 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.
15 export default function smoothScroll() { 16 if (window.location.hash) { 17 if (initialRender) { 18 setTimeout(() => { 19 initialRender = false; 20 scrollToHash(); 21 }, 300); 22 } else { 23 scrollToHash(); 24 } 25 } else { 26 animateScroll(0); 27 } 28 }
20 function myScroll() { 21 documentYposition += scrollAmount; 22 window.scrollBy(0, scrollAmount); 23 if (getScrollPosition() + 300 < documentYposition) { // wait 300 pixels 24 // until we refresh 25 window.clearInterval(scrollTimer); 26 window.scroll(0, 0); // scroll back to top and then refresh 27 location.href = location.href; 28 } 29 }
208 function smoothScrolling() { 209 //Special case for chat 210 if ($(".active").attr('id') === "chat") { 211 smoothScrollBottom(); 212 } 213 }
28 function smoothScroll(left: number, top: number) { 29 try { 30 window.scroll({ 31 top, 32 left, 33 behavior: 'smooth', 34 }) 35 } catch (e) { 36 window.scroll(left, top) 37 } 38 }
40 function smoothScrollTop () { 41 var position = window.scrollY || window.pageYOffset; 42 var speed = position / 10; 43 44 if (position > 1) { 45 var newPosition = position - speed; 46 47 window.scrollTo(0, newPosition); 48 window.requestAnimationFrame(smoothScrollTop); 49 } else { 50 window.scrollTo(0, 0); 51 } 52 }
11 function autoscrollTestPart1() 12 { 13 var ta = document.getElementById('ta'); 14 if (window.eventSender) { 15 ta.scrollIntoView(); 16 var h = ta.offsetTop - document.body.scrollTop + 10; 17 eventSender.dragMode = false; 18 eventSender.mouseMoveTo(20, h); 19 eventSender.mouseDown(); 20 eventSender.mouseMoveTo(20, h); 21 eventSender.mouseMoveTo(100, h); 22 } 23 setTimeout(autoscrollTestPart2, 100); 24 }
8 export function smoothScroll(selector) { 9 $(document).SmoothScroll({ 10 target : selector, 11 duration: 1000, 12 easing : 'easeOutQuint', 13 offset : () => getScrollOffset(), 14 }); 15 }
35 scrollToMiddleItem() { 36 this.setState({ visbleIndex: 12 }); 37 }
5 function smooth_scroll_up(){ 6 var current_pos = document.documentElement.scrollTop || document.body.scrollTop; 7 if (current_pos > stop_pos) { 8 //console.log(current_pos/10); for testing 9 window.requestAnimationFrame(smooth_scroll_up); 10 window.scrollTo (0, current_pos - (current_pos/10)); 11 } else { 12 window.scrollTo (0, stop_pos); 13 } 14 }
39 scrollToSecondToLastItem() { 40 this.setState({ visbleIndex: 19 }); 41 }