node.js - In Sails express node js how to display an ad while the requested page loads -


some data processing takes few seconds once server has received client's request...

how can display advertisement while client waits payload ?

same question , without ajax

we may not use library or framework on top of sails, unless necessary

you can simple loading graphic, , replace whatever image want:

html

<div class="loader"></div> 

css

.loader {   position: fixed;   left: 0px;   top: 0px;   width: 100%;   height: 100%;   z-index: 9999;   background: url('images/page-loader.gif') 50% 50% no-repeat rgb(249,249,249); } 

a simple jquery function:

$(window).load(function() {     $(".loader").fadeout("slow"); }) 

demo

source: display loading image while page loads

if need without jquery, more involved, can more information in thread:

$(document).ready equivalent without jquery


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -