I am getting this error in my browser console, while I am using jQuery “.load”. I will try to display page loader while my page is loading, but it all time loading. How can I stop page loader while page content displays properly?
I am following this jQuery code:
<script>
$(window).load(function() {
$(“.page_loader”).fadeOut(1000);
});
</script>
My console error:
TypeError: a.indexOf is not a function error when opening new foundation project
If you are using jQuery v3 version then you need to just small changes. There has the problem to use “load”, use on(“load”) function for this work.
Copy this example code and replace to your code.
<script>
$(window).on(‘load’, function(){
$(“.page_loader”).fadeOut(1000);
});
</script>
Hope this code will be work properly.