0

I have following html

<body> <div class="menus"></div> <div class="maincontent"></div> <div class="footer"></div> </body> 

Now when the page loads I want to show div class menus and footer and until the page loads loader image in div maincontent. How am I to achieve this? I tried putting loader div inside maincontent and using $(window).load(function(){}) but to no avail. Any idea and suggestions is welcome.

1

2 Answers 2

0

This should be the initial HTML.

<body> <div class="menus"></div> <img src="ajaxloader.gif" class="loader" style="display:block"/> <div class="maincontent" style="display:none"> </div> <div class="footer"></div> </body> 

After this, you can hide the loader once the page loads and show the main content. If you are using Jquery, this can be done as follows

$(document).ready(function(){ $('.loader').hide(); $('.maincontent').show(); }); 
Sign up to request clarification or add additional context in comments.

Comments

0

Try this,

$(document).ready(function(){ $(".maincontent").fadeOut( "slow"); $(".menus,.footer").fadeIn("slow", function() { $(this).text("menu, footer"); }); }); 

After window loading,main content loading image hide and menu, footer shows

CheckFiddle

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.