5
I have a code that makes a loading animation before starting a page.
css.
.preload{
position: fixed;
z-index:99999;
top:0; left:0;
width:100%; height:100%;
opacity:1;
background-color:#fff;
/*background-image:url('https://38.media.tumblr.com/bec5933eea5043acf6a37bb1394384ab/tumblr_meyfxzwXUc1rgpyeqo1_400.gif');
background-image:url('https://media.giphy.com/media/ugEWbEMH0gm2c/giphy.gif');*/
background-image:url('https://media.giphy.com/media/l4FGmQ3Ddqsp8LKKY/giphy.gif');
background-size:70%;
background-position:center;
background-repeat:no-repeat;
}
index php.
<div id="preload" class="preload"></div>
right after the tag body has this div who does the animation loading.
php script.
<script>
$(document).ready(function(){
$("#preload").fadeOut(1000);
});
</script>
My question is this: Why when I change . ready to . load the animation becomes infinite? And because before loading all the images the animation disappears?
Thank you very much, I didn’t know that in Document there was no way to use it. load(), the way you left it works, but only with jquery 2.1.1, I use 3.3.1, and in it the loop. :/
– Pedro Henrique
@Pedrohenrique, edited and solved. It’s always good to tell us which versions you are using. If this answer solved your problem, please mark it as a solution.
– reisdev
Thank you very much, it worked well.
– Pedro Henrique