I tried to make Scrollspy smooth scroll using bootstrap. This works, but the scroll target is wrong.
You can see my fiddle : http://jsfiddle.net/gdfqtLxh/12/
UPDATE VIDEO : https://youtu.be/pZCc90Dv5kw
If you click on the second menu, it will work well, but when you click on the third menu, it doesn't go to the right target.
This is my javascript..
$("#list-example a[href^='#']").on('click', function(e) {
// prevent default anchor click behavior
event.preventDefault();
// store hash
var hash = this.hash;
// animate
$('.scrollspy-example').animate({
scrollTop: $(hash).offset().top
}, 300);
});
UPDATE VIDEO (Added some text) : https://youtu.be/921oDDaSZq0