-
-
Save pije76/897d743686c522964971e5342bbf2345 to your computer and use it in GitHub Desktop.
facetwp fade out/in with pre-load
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
<?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