Jump to content

image effect while waiting page load


zsgiancarlo

Recommended Posts

Use Javascript in your theme to add a class when the page starts loading:

$('body').addClass('page-loading');

Create CSS like this:

body.page-loading:after {
    display: block;
    content: " Loading ";
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    background: rgba(0, 0, 0, 0.8);

}

Then in Javascript use jQuery to bind to when the page has finished loading:

$(function () {
    $('body').removeClass('page-loading');
});

That's a simple example.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...