$(document).ready(function() {

    $('.scrolled').on('click', function(e) {
        $('.scrolled').removeClass('actived');
        var targetId = $(this).attr('href');
        $(this).addClass('actived');
        var offsetTop = $(targetId).offset().top - 100;
        $('html, body').animate({
            scrollTop: offsetTop
        }, 700); // Adjust scroll speed here (ms)
    });

});