• Resolved backpackingseries

    (@backpackingseries)


    Hi,

    Some of the accordians I use for FAQs have large sets of data/tables. So when, after reading its contents, I open the next accordian below, it should get in focus on the screen. However, currently it goes back all the way up, sometimes showing the site footer in focus and needs a user to scroll back to the desired FAQ.

    Is there a way to fix this such that everytime, the accordian that’s opened stays anchored on the screen?

    Kind regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey,
    I don’t suggest auto-closing accordions if they get this long. There is a setting within the block that allows for multiple to be open at once. This creates a better user experience without the page size changing so drastically that you wind up somewhere completely different on the page.

    However, if this is how you want to run it you can add some javascript which would force a takeover of the scroll and try to scroll to the opened accordion.

    <script>
    jQuery( document ).ready( function( $ ) {
    $( '.kt-blocks-accordion-header' ).click( function( ) {
    var pane = $(this);
    setTimeout(function(){
    var $panel = pane.closest('.kt-accordion-pane');
    $('html,body').animate({
    scrollTop: $panel.offset().top
    }, 500); 
    }, 300 );
    });
    });
    </script>

    Ben

    Thread Starter backpackingseries

    (@backpackingseries)

    Thank you @britner. Appreciate your support.

    Kind regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Accordian Focus’ is closed to new replies.