Skip to content

Instantly share code, notes, and snippets.

@pije76
Forked from djrmom/custom-hooks.php
Created July 15, 2019 04:48
Show Gist options
  • Save pije76/897d743686c522964971e5342bbf2345 to your computer and use it in GitHub Desktop.
Save pije76/897d743686c522964971e5342bbf2345 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