I have an accordion from Bootstrap 4 where I want when I click any of the accordion's tabs the page scrolls to its section.
$('.toggling-tabs').on('click', function () {
    if ($('.sections').hasClass('collapsing')) {
        $('html, body').animate({
                scrollTop: $('.sections').offset().top
            },
            'slow');
    }
});
I got this jQuery snippet where it works with only one of the tabs of the accordion. .toggling-tabs is the class for the accordion tabs and .sections is the class for the sections where when pressing any tab the page should scroll to.
How can I make the code work for all the tabs when any is clicked either using JS or jQuery.
Update:
<div class="col-lg-3 col-md-6 col-sm-12 toggling-tabs">
    <div class="port-item p-4 bg-primary" data-toggle="collapse" data-target="#home">
        <i class="fa fa-home d-block pb-2"></i> Home
    </div>
</div>
<!-- Some stuff in between -->
<section class="collapse show sections" id="home">
   <div class="card card-body bg-primary text-white py-5 banner">
      <h2>Welcome to my portfolio</h2>
    </div>
</section>
<section class="collapse collapsing sections" id="resume">
    <div class="card card-body bg-success text-white py-5">
        <h2>My Resume</h2>
    </div>
</section>
 
     
     
    