I have this pulse loader code implemented into the wordpress theme (special thanks to @dcardoso), as follows:
dcardoso.js
file registered in script-calls.php
:
jQuery(function($){
$(window).load(function(){
$(".sk-spinner-pulse").fadeOut(1500);
$("#wrapper").css("opacity","1");
});
});
in the main theme app.min.js
file, this sequence:
...
var $doc = $(document), win = $(window), Modernizr = window.Modernizr, AnimationsArray = [];
window.SITE = {
init: function() {
var self = this, content = $("#wrapper"), pl = content.find(">.sk-spinner-pulse.sk-spinner"), count = $("body").data("cart-count");
favicon = new Favico({
bgColor: "#151515",
textColor: "#fff"
}), favicon.badge(count), content.waitForImages(function() {
TweenMax.to(pl, 1, {
autoAlpha: 0,
ease: Quart.easeOut,
onComplete: function() {
pl.css("display", "none");
}
});
...
Also in app.css
, the preloader section:
...
#wrapper .sk-spinner-pulse.sk-spinner {
left: 50%;
position: fixed;
top: 50%;
width: 45px;
height: 45px;
margin: 0 auto;
background-color: gold;
border-radius: 100%;
-webkit-animation: sk-pulseScaleOut 1s infinite ease-in-out;
animation: sk-pulseScaleOut 1s infinite ease-in-out;
}
@-webkit-keyframes sk-pulseScaleOut {
0% {
-webkit-transform: scale(0);
transform: scale(0);
}
100% {
-webkit-transform: scale(1);
transform: scale(1);
opacity: 0;
}
}
@keyframes sk-pulseScaleOut {
0% {
-webkit-transform: scale(0);
transform: scale(0);
}
100% {
-webkit-transform: scale(1);
transform: scale(1);
opacity: 0;
}
}
.site_bars_off #wrapper .sk-spinner-pulse.sk-spinner {
margin-left: 0;
margin-right: 0;
}
.site_bars_off #wrapper .sk-spinner-pulse.sk-spinner {
margin-left: 0;
margin-right: 0;
}
@media only screen and (max-width: 40.063em) {
#wrapper .sk-spinner-pulse.sk-spinner {
margin-left: 0;
margin-right: 0;
}
}
...
The main goal is to keep on top of the pulse-loader-fading-out-background, the logotext <div class="small-7 medium-4 columns logo">
and the menu <nav class="pagedMenu" role="navigation">
before/while the content is loading into the page.
I’ve tried to modify the z-index
values but without any good result, I think there is much more than that. At this point I was wondering, what is the best way to approach this?
Here is a functional example and here is my site link. Please ignore the ajaxify misbehaving, just press F5 to see the loader; actually I am looking for a workaround (not on page refresh – I am sure about that) to this question.
Any thoughts? I appreciate it.