Skip to content

Instantly share code, notes, and snippets.

@LaxusCroco
Last active February 23, 2024 15:24
Show Gist options
  • Save LaxusCroco/869bee75c0012286bc3a06ce1efe4b12 to your computer and use it in GitHub Desktop.
Save LaxusCroco/869bee75c0012286bc3a06ce1efe4b12 to your computer and use it in GitHub Desktop.
jQuery( document ).ready( function( $ ) {
$(window).on( 'jet-popup-open-trigger', function( event ) {
let id = event.popupData.postId ?? '',
slider = $(`#${event.popupData.popupId ?? ''} .gallery-list .jet-listing-grid__items`);
if ( ! slider.length ) {
return;
}
let index = slider.find( `[data-slick-index][data-post-id='${id}']` )[0].dataset.slickIndex;
if ( ! index ) {
return;
}
slider.slick( 'slickGoTo', `${index}` );
} );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment