Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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;
    });
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #scroll #div #js
ADD COMMENT
Topic
Name
3+7 =