Skip to content

Instantly share code, notes, and snippets.

@wplit
Last active September 23, 2021 01:56
Show Gist options
  • Save wplit/addb5e12b50625c5ab0ab58a061cf325 to your computer and use it in GitHub Desktop.
Save wplit/addb5e12b50625c5ab0ab58a061cf325 to your computer and use it in GitHub Desktop.
open accordion header when linked to with button. updated - add to code block
jQuery(document).ready(function($) {
let buttonSelector = '.research-card-image-overlay';
let delay = 500;
$(buttonSelector).on('click', function() {
if ($(this).attr('href')) {
let hash = $(this).attr('href').split('#')[1];
if (hash) {
setTimeout(function(){
if ('false' === $('#' + hash).find('.oxy-pro-accordion_header').attr('aria-expanded')) {
$('#' + hash).find('.oxy-pro-accordion_header').trigger('click');
}
}, delay);
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment