Created
July 19, 2016 10:26
-
-
Save timneutkens/cde9a2d63addb9a6bd396e0bf1118bd1 to your computer and use it in GitHub Desktop.
jQuery UI accordion scroll to clicked tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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