Skip to content

Instantly share code, notes, and snippets.

@djrmom
Created August 10, 2018 11:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save djrmom/6b0ba3fe642bb013b497c47112a6a7fa to your computer and use it in GitHub Desktop.
Save djrmom/6b0ba3fe642bb013b497c47112a6a7fa to your computer and use it in GitHub Desktop.
facetwp fade out/in with pre-load
<?php
/**
** update of https://facetwp.com/fade-template-content-during-refresh/ to only fade in on pre-load
**/
add_action( 'wp_footer', function() { ?>
<style>
.facetwp-template {
opacity: 0;
}
</style>
<script>
(function($) {
$(document).on('facetwp-refresh', function() {
if ( FWP.loaded ) {
$('.facetwp-template').animate({opacity: 0}, 1000);
}
});
$(document).on('facetwp-loaded', function() {
$('.facetwp-template').animate({ opacity: 1 }, 1000);
});
})(jQuery);
</script>
<?php });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment