Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timneutkens/cde9a2d63addb9a6bd396e0bf1118bd1 to your computer and use it in GitHub Desktop.
Save timneutkens/cde9a2d63addb9a6bd396e0bf1118bd1 to your computer and use it in GitHub Desktop.
jQuery UI accordion scroll to clicked tab
function scrollTo(element) {
jQuery('html, body').animate({
scrollTop: jQuery(element).offset().top
}, 500);
}
jQuery('.accordion').on('accordionactivate', function( event, ui ) {
scrollTo(jQuery(event.target).find('.ui-accordion-header-active'))
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment