Answers for "scroll a div with js"

7

js scrolling in div

var divElement = document.getElementById("div");
divElement.scroll({
	top: divElement.scrollHeight,//scroll to the bottom of the element
	behavior: 'smooth' //auto, smooth, initial, inherit
});
Posted by: Guest on July-11-2020
0

a scroll to div js

//scroll to id
    var $root = $('html, body');
    $('a[href^="#"]').click(function () {
        var href = $.attr(this, 'href');
        $root.animate({
            scrollTop: $(href).offset().top
        }, 500, function () {
            window.location.hash = href;
        });

        return false;
    });
Posted by: Guest on September-14-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language