I create a scroll down who works with 2 buttons, one button to start and the other to stop. But if I press the start more times it won't stop. Also what I can do to stop when arrives in the end of the div/page?
HTML
<div data-role="main" class="ui-content">
<!--εδώ γράφω-->
<div class="btn-group" style="width:100%">
<button onclick="start_scroll_down()" class="ui-btn ui-btn-inline ui-shadow" style="width:46%" style="position:fixed;">Start SD</button>
<button onclick="stop_scroll_down()" class="ui-btn ui-btn-inline ui-shadow" style="width:46%" style="position:fixed;">Stop SD</button>
</div>
<div class="article">
<center>
<!--text-->
</center>
</div>
</div>
Javascript
function start_scroll_down() {
scroll = setInterval(function() {
window.scrollBy(0, 1);
console.log('Ξεκίνα');
}, 150);
}
function stop_scroll_down() {
clearInterval(scroll);
console.log('Σταμάτα');
}