Bootstrap accordion scrolltop animation

$(‘.panel-collapse’).on(‘shown.bs.collapse’, function (e) {
var $panel = $(this).closest(‘.panel’);
$(‘html,body’).animate({
scrollTop: $panel.offset().top
}, 500);
});

Bootstrap accordion, scroll to top of active (open) accordion on click? https://stackoverflow.com/questions/35992900/bootstrap-accordion-scroll-to-top-of-active-open-accordion-on-click