Accordion weird jumps even with JS

Hi,
I found in another post by @Lely this JS code to manage the weird accordion scrolls when an item is opened while another one’s closing automatically.

jQuery(document).ready(function($) {
  $('.x-acc-header').unbind().on('click', function(){
    var $this = $(this);
    setTimeout(function() {
      $('html, body').animate({
      scrollTop: $this.offset().top
      }, 500);
    }, 100);
  });
});

From Mobile, it does work fine if I browse the different items from top to bottom, but when I tap on the 6th item after tapping the 5th and then back to 6th (for example), something really weird happen that I don’t understand.

Here’s the page
https://demo.strategaconsulting.biz/industries/

This happens even on other pages, which make me think there’s something odd with the JS code but I’m not too much into JS, so I dunno how to solve it.

Thanks for your help

Cheers
Alessandro

Hi Alessandro,

I have tested it on actual mobile, chrome browser and I cannot see anything weird. It works as expected. It opens and scroll correctly.

The JS code above is specific for accordion. Can you give us a screencast of the issue? Also can you give a more detailed description please. What mobile and browser are using when you saw the issue? We need all information we can get so can see the actual issue first. Thank you

I tested it with Safari and Google Chrome on iPhone 11 / iOS 13.3

I really can’t explain it better than you can watch it yourself:


You can download the screen capture video from this link.

Thanks for your advice.
Alessandro

Hi Alessandro,

The script that you use to snap on top the open accordion is causing the issue, it does not account the open accordion when you click another accordion-item that is under the open one. The offset is mess up even on desktop.

Regretfully, this particular customization request is outside the scope of our support as this is not related to an issue with the theme and instead has to do with your customization of it. As such, you will need to investigate this particular issue on your own or seek help from a developer should you not feel comfortable making these changes yourself.

Thank you for your understanding.

No problem

At least I know it’s not just something I got :wink:

Cheers

Thanks, Alessandro :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.