javascript - background-image not fading in properly -
i've been working on loading screen one-page website, loading screen nothing more svg logo drawing out works fine, once 'loading' done fade out loading screen , fade in content of website.
it works fine except fact when content fades in shocks bad because of background-image, know not background-image loading because whole reason there loading screen @ give website time load of images, reason fadein not working properly.. perhaps it's way set animations, have look: (i use jquery , animate.css fades)
jquery: settimeout(function() { $("#builds").children().addclass("animatedlogo");
settimeout(function() { $(".loadinglogo").addclass("fadeout"); settimeout(function() { $(".loadingscreen").addclass("fadeout"); settimeout(function() { $(".loadingscreen").css('display', 'none'); settimeout(function() { $("body").css('overflow-y', 'auto'); $(".contentwrapper").addclass("fadein").show(); $("header").addclass("fadein").show(); settimeout(function() { $("body").css('background-color', "#fff"); }, 500) }, 500) }, 500) }, 500) }, 3400)
html:
<div class="loadingscreen animated"> <div class="loadinglogo animated"> <svg> //svg logo </svg> </div> </div> <div class="contentwrapper animated"> @yield('content') </div>
so pretty know there wrong way doing this, perhaps doing performance heavy? suggestions on how differently appreciated! thanks!
as want display loading screen until page content loads, can replace existing code code:
html
<div class="se-pre-con"></div>
css
.se-pre-con { position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 9999; background: url(images/loader-64x/preloader_2.gif) center no-repeat #fff; }
note: change background url in css. replace svg file going shown loading image.
javascript
$(window).load(function() { // animate loader off screen $(".se-pre-con").fadeout("slow"); });
in scenario, don't need fade in page content manually. page loads content , window ready, loading screen automatically fade out , page visible users. page's background image not bad, because loaded on screen.
you can click here further details.
give try approach , hope overcome issue.
Comments
Post a Comment