Answers for "onclick scroll to specific div in js"

0

how to add scroll to div onclick

<div class="first"><button type="button" onclick="smoothScroll(document.getElementById('second'))">Click Me!</button></div>
<div class="second" id="second">Hi</div>
Posted by: Guest on November-22-2020
0

how to add scroll to div onclick

$("button").click(function() {
    $('html,body').animate({
        scrollTop: $(".second").offset().top},
        'slow');
});
Posted by: Guest on November-22-2020

Browse Popular Code Answers by Language