Last active
January 21, 2025 18:07
-
-
Save Crocoblock/6db7f99e8a9353183aecb8409348cecd to your computer and use it in GitHub Desktop.
JetPopup Scroll JetEngine Listing Grid slider to a corresponding slide on opening popup
This file contains hidden or 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
<script> | |
jQuery( document ).ready( function( $ ){ | |
$( window ).on( 'jet-popup-open-trigger', function( event ) { | |
let id = event?.popupData?.postId; | |
if ( ! id ) { | |
return; | |
} | |
let slider = $( `#${event.popupData.popupId} .jet-popup__inner .gallery-list .jet-listing-grid__items.slick-initialized` ); | |
if ( ! slider.length ) { | |
return; | |
} | |
let slide = slider.find( `[data-post-id='${id}']` ); | |
if ( ! slide?.length ) { | |
return; | |
} | |
let index = slide[0]?.dataset?.slickIndex; | |
if ( ! index ) { | |
return; | |
} | |
slider.slick( 'slickGoTo', `${index}` ); | |
} ); | |
} ); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment