I am using a javascript code for the F12 console to automatically scroll down. It works fine, but I want it to stop after 250 times. How to do that?
var scroll = setInterval(function(){ window.scrollBy(0,1000); }, 2000);
I am using a javascript code for the F12 console to automatically scroll down. It works fine, but I want it to stop after 250 times. How to do that?
var scroll = setInterval(function(){ window.scrollBy(0,1000); }, 2000);
var count = 1;
var scroll = setInterval(() => this.executeInterval(), 10);
function executeInterval() {
window.scrollBy(0,1000);
console.log(count)
if(count == 250) clearInterval(scroll);
count++;
}
Forgot the function. press on run code snippet.
var scroll = setInterval(function(){ window.scrollBy(0,1000); }, 2000);
setTimeout(function() {
clearInterval(scroll)
}, 250 * 2000)