{"id":12840,"date":"2023-01-02T14:24:06","date_gmt":"2023-01-02T19:24:06","guid":{"rendered":"http:\/\/local.brightwhiz\/?post_type=snippets&p=12840"},"modified":"2023-01-02T14:24:09","modified_gmt":"2023-01-02T19:24:09","slug":"continuous-scrolling-javascript","status":"publish","type":"snippets","link":"http:\/\/local.brightwhiz\/snippets\/continuous-scrolling-javascript\/","title":{"rendered":"Continuous Scrolling JavaScript Example Code"},"content":{"rendered":"\n
Use this to implement continuous scrolling in JavaScript.<\/p>\n\n\n\n
var scrollDirection = 10;\nfunction pageScroll() {\n window.scrollBy(0,scrollDirection); \/\/ horizontal and vertical scroll increments\n scrolldelay = setTimeout('pageScroll()',5); \/\/ scrolls every 50 milliseconds\n if ((window.scrollY === 0) || \n (window.innerHeight + window.scrollY) >= document.body.offsetHeight) {\n scrollDirection = -1*scrollDirection;\n }\n}\npageScroll();<\/code><\/pre>\n","protected":false},"comment_status":"open","ping_status":"closed","template":"","meta":[],"categories":[953,23,25,27,15,16],"tags":[328,424,433,449,544,591,635,638],"yoast_head":"\nContinuous Scrolling JavaScript Example Code [Snippet]<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n