Created
August 10, 2018 11:49
-
-
Save djrmom/6b0ba3fe642bb013b497c47112a6a7fa 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