Last active
September 2, 2024 13:09
-
-
Save ericandrewlewis/1f0424858b389c7ad7531ebba4fa3b30 to your computer and use it in GitHub Desktop.
Revisions
-
ericandrewlewis revised this gist
Jul 31, 2017 . No changes.There are no files selected for viewing
-
ericandrewlewis revised this gist
Jul 31, 2017 . 1 changed file with 0 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,5 @@ # Scroll to the rock bottom of a website Throw the script below in the browser's JS console. It moves the viewport to the bottom of the page repeatedly with a delay in between. This is useful when the page loads data via infinite scroll and you want to do something with all the data. -
ericandrewlewis revised this gist
Jul 31, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
Binary file not shown. -
ericandrewlewis revised this gist
Jul 31, 2017 . 2 changed files with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ # Scroll to the rock bottom of a website <img src="https://gist.github.com/ericandrewlewis/1f0424858b389c7ad7531ebba4fa3b30/raw/33d8076d9187fd92bf8bcc6b21bd3b8287259702/z_example.gif"> Throw the script below in the browser's JS console. It moves the viewport to the bottom of the page repeatedly with a delay in between. This is useful when the page loads data via infinite scroll and you want to do something with all the data. LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
ericandrewlewis renamed this gist
Jul 31, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes -
ericandrewlewis revised this gist
Jul 31, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
ericandrewlewis revised this gist
Jul 31, 2017 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,8 @@ # Scroll to the rock bottom of a website Throw the script below in the browser's JS console. It moves the viewport to the bottom of the page repeatedly with a delay in between. This is useful when the page loads data via infinite scroll and you want to do something with all the data. ```js const atPageBottom = () => { -
ericandrewlewis revised this gist
Jul 31, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,6 @@ If you want to scroll to the bottom of a website throw this in the JavaScript console. It will move the viewport to the bottom of the page repeatedly with a delay in between. This is useful when the page is loading data via infinite scroll and you want to do something after all the data loads. ```js const atPageBottom = () => { -
ericandrewlewis created this gist
Jul 31, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ If you want to scroll to the bottom of a website with infinite scroll, throw this in the JavaScript console. ```js const atPageBottom = () => { const scrolled = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop; const documentHeightMinusOneViewport = document.body.scrollHeight - Math.max(document.documentElement.clientHeight, window.innerHeight || 0); return Math.abs( documentHeightMinusOneViewport - scrolled ) < 3; } const scrollUntilAtPageBottom = () => { if (atPageBottom()) { return Promise.resolve(true); } window.scrollTo(0, document.body.scrollHeight); return (new Promise((resolve, reject) => { setTimeout(() => { resolve(true); }, 1000) })) .then(scrollUntilAtPageBottom); } scrollUntilAtPageBottom(); ```