I wanted to implement an effect that spins around like a loading indicator so you can see it’s loading when WordPress loads. Implementing it with a plugin seems easy.
Page Loading Effects
You can easily implement it using a plugin called Page Loading Effects. I was thinking of using Preloader because it’s more popular, but it didn’t work.
Other Methods
I actually wanted to set up something like this, but I gave up because I couldn’t do it.
<!-- Loading spinner -->
<script type="text/javascript">
$("#showspin").on("click", function(){
$("somediv .spinner").show();
});
</script>
<style media="screen">
.spinner {
background: url('/wp-admin/images/wpspin_light.gif') no-repeat;
background-size: 16px 16px;
display: none;
float: right;
opacity: .7;
filter: alpha(opacity=70);
width: 16px;
height: 16px;
margin: 5px 5px 0;
}
</style>
<div class="spinner"></div>
or
<!-- Loading spinner -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.2/modernizr.js"></script>
<script type="text/javascript">
//paste this code under the head tag or in a separate js file.
// Wait for window load
$(window).load(function() {
// Animate loader off screen
$(".se-pre-con").fadeOut("slow");;
});
</script>
<style media="screen">
/* Paste this css to your style sheet file or under head tag */
/* This only works with JavaScript,
if it's not present, don't show loader */
.no-js #loader { display: none; }
.js #loader { display: block; position: absolute; left: 100px; top: 0; }
.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;
}
</style>
<div class="se-pre-con"></div>
I thought it could be implemented like this, but it didn’t work.