Click here to Skip to main content
15,067,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
When I Load page first time Window.load works fine in all browsers,

When I do some server side event and when page refreshes on postback window.load not firing in chrome and firefox.

why I use window.load is , In document.ready Images are not loading completely ,

So I have to run script after loading all the images in the page, so I Use Window.load.

C#
$(window).load(function () {
          var ScreenHeight = window.innerHeight;
          var FooterDivHeight = $('#trFooter').height();
          var FooterDivTopHeight = $('#trFooter').position().top;
          var EmptySpace = ScreenHeight - FooterDivTopHeight - FooterDivHeight - parseInt(5);
          $('#tdFooter').css({
              'padding-top': EmptySpace + "px"
          });
      });


In Document.ready calculations differ If Images Present in the page.
Posted
Comments
Arora_Ankit 13-Oct-14 7:17am
   
are you using partial postback?
nandakishoreroyal 13-Oct-14 7:25am
   
When any click event fires from Code behind, window.load not firing.
Arora_Ankit 13-Oct-14 7:26am
   
are you using ajax/updatepanel?

1 solution

you can use pageLoad() as I used that in my apps and it was working in all browsers.

JavaScript
function pageLoad()
{
 var ScreenHeight = window.innerHeight;
          var FooterDivHeight = $('#trFooter').height();
          var FooterDivTopHeight = $('#trFooter').position().top;
          var EmptySpace = ScreenHeight - FooterDivTopHeight - FooterDivHeight - parseInt(5);
          $('#tdFooter').css({
              'padding-top': EmptySpace + "px"
          });
}
   
Comments
nandakishoreroyal 13-Oct-14 9:41am
   
Thank you Arora For your reply,

Iam not using updatepanel,

And Where and when should I call this Pageload method.
Arora_Ankit 13-Oct-14 10:10am
   
Just add this function in your page's javascript and this will automatically call when page rendering completes

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900