How to add gif as preloader in wordpress?

add your code with class for ex .loading-wrapper in your header then add this code in your script

setTimeout(function(){
$('.loading-wrapper').slideUp();}, 5000);