[Accordian close]Auto close first item when second item is clicked

Hi everyone.

I have some problem using with Accordian widget.

my requirement is :focus on  the clicked element and auto close the first element.

I know that outsystems can do this.But I put some javascript because of I need.(I mean :there are alot of items to display in first accordian but a few items  in second accordian,so I click second accordian the first accordian is closed and moving scroll to top to see expand items of second accordian.When I put javascript I can see the expand item but the first accordian is not close.Some body point me please what should I do.

The javascript I put is below 

SyntaxEditor Code Snippet

function SetEventMoveOpenItemToTop(){
  $( ""accordion-item-title"" ).click(function() {
    $('html').animate({scrollTop: $('.accordion-item is--open').offset().top-50}, 'fast');



I tried to simulate the situation but everything goes right.

Could you please make available the OML file? Are you using OS10 or OS11?