Skip to content

Instantly share code, notes, and snippets.

@DavidCramer
Created March 20, 2017 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidCramer/1a110a67ec5adeb18301f9fe92ee9a7f to your computer and use it in GitHub Desktop.
Save DavidCramer/1a110a67ec5adeb18301f9fe92ee9a7f to your computer and use it in GitHub Desktop.
initilize the quickview for woocommerce-lightbox on facetwp-loaded event.
<?php
// add the below code to your child themes functions.php file.
add_filter( 'facetwp_assets', function( $assets ) {
?>
<script>
(function($) {
$(document).on('facetwp-loaded', function() {
$('.product').magnificPopup({
type:'inline',
midClick: true,
gallery:{
enabled:true
},
delegate: 'a.wpb_wl_preview',
removalDelay: 500, //delay removal by X to allow out-animation
callbacks: {
beforeOpen: function() {
this.st.mainClass = this.st.el.attr('data-effect');
}
},
closeOnContentClick: false,
});
});
})(jQuery);
</script>
<?php
return $assets;
});
@sensusmedia
Copy link

this snippet just saved me! thanks so much man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment