Having trouble with an issue. Let me explain.
I implemented a scrollTop Jquery on page load that scrolls down after a delay to prompt user action. However, I'm facing a problem where another scrollTop doesn't work after clicking buttons "#b3,#b3b" and fails to scroll to the bottom of the page as intended.
The desired behavior is for it to scroll to the element with the class .comp at the bottom, but it either doesn't scroll all the way or just moves slightly downwards.
If you have any insights on how to make the page scroll to the bottom element successfully the second time after clicking the button, please share them!
$(document).ready(function () {
$('html, body').delay(1500).animate({
scrollTop: $('.button').offset().top
}, 'slow');
// Further Javascript code here...
});
* {
// CSS styles here...
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="wrap">
<div id="header"><h1>Lorem ipsum dolor sit amet, consectetur adipiscing elit...</h1>
</div>
<div id="content">
<div id="graphic"><img src="#" alt="" height="500px" width="300px"></div>
<div id="text">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit...</p>
<div class="actionbox" id="a3" style="display:block">
<h2><strong>Question 3:</strong></h2>
<div class="butbox">
<div class="button buttxt" id="b3"><a href="#/">YES</a></div>
<div class="buttonr buttxt" id="b3b"><a href="#/">NO</a></div>
</div>
</div>
<div class="actionbox" id="a4">
<div id="bar"><div id="percentage"></div></div>
<h3 id="r1">step1...</h3>
<h3 id="r2">step2...</h3>
<h3 id="r3">step3...</h3>
<h3 id="r4">step4...</h3>
// More HTML content here...
</div>
</div>
</div>
</div>