$('a[href^="#"]').on("click", function(){ var the_id = $(this).attr("href"); $('html, body').animate({ scrollTop:$(the_id).offset().top }, 'slow'); return false; }); // si scroll dans un conteneur : // scrollTop: $(elemId).parent().scrollTop() + $(elemId).offset().top - $(elemId).parent().offset().top // http://www.qlambda.com/2012/10/smoothly-scroll-element-inside-div-with.html