Notice: These forums are now retired and closed. For active support, please Submit a Ticket or visit our official WordPress.org community pages.
Kadence Theme | Kadence Blocks | Starter Templates | WooCommerce Email Designer | Ascend | Virtue | Pinnacle

Stop accordion panel scrolling

Home / Forums / Kadence Blocks / Stop accordion panel scrolling

This topic is: Not Resolved
[Not Resolved]
Posted in: Kadence Blocks
March 3, 2023 at 8:51 am

Is there a way to stop accordion panels from scrolling off the page when expanded? It is especially apparent with panels that have a lot of content on mobile.
I found the script fix below in the Kadence forums and it works by offsetting and re-scrolling but I believe that there might be a nicer way to do this, maybe by changing the accordion header button trigger code some day? THANK YOU.

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 - 300
}, 300);
}, 300 );
});
});

  • The forum ‘Kadence Blocks’ is closed to new topics and replies.