Hello I want to make scroll to target inside my div with option: overflow:hidden but I doesn't work good. I don't know why my scroll script behave strange. It doesn't scroll to correct target or when I click twice on one button it back to another target. What is wrong with this? Could you help me.
$('a[href^="#"]').on('click',function (e) {
e.preventDefault();
//shows what href contains
var target = this.hash,
$target = $(target);
$('.content').stop().animate({
'scrollTop': $target.offset().top-187 //scroll to top position on href element for example #about
}, 1000, 'swing');
});