function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sahisahi 

Reg:To fade a page when it is loading.

 

   In my application I need to fade the page on load(when it is loading).

 

      I have used this code but its not working...

 

<script>
$(document).ready(function(){

 

$(document).ready(function () {$('.nav').fadeIn(3000);});
});</script>

    and then div tag <div class="nav" style="display:none"> 

before closing page tag.

 

Can any one help me.

*werewolf**werewolf*

Did you include the JQuery library on your page?  You are using JQuery constructs there, but without the JQuery library they will not work.

sahisahi

   I have uploaded the jQuery library in static resources 

 

               and I am using that in page by the includeScript.

*werewolf**werewolf*

And why do you have the 

 

$(document).ready(function () {

 

twice?

sahisahi

 

I am new to Java Script and I have seen that code in search for fading the page onload.

*werewolf**werewolf*

I am not contesting the fadeIn part (although I hope your "nav" div actually has something in it).  I am saying that you have the document.ready stuff twice, and you only need it once.

sahisahi

 

Ya I got it.

 

   Yes there is no need to use the ready function twice,also the nav class.
  

 

 

 

sahisahi

 

I am very thank ful for your reply...

 

 

jshimkoskijshimkoski

Just a note about jQuery...

 

You should always do your best to use IDs and not classes when calling an element and should always avoid inline styling.

 

<style>

.hide{display:none;}

</style>

 

<div id="divID" class="divClass hide">Test</div>

 

Calling: $("#divID") is much faster then calling: $(".divClass")

 

If you absolutely need to call the class, try adding in the element type; it will speed up performance: $("div.divClass")

 

On a side note, calling $("div#divID") is actually slower than calling $("#divID") and is pretty redundant as every element on a page should have a unique id.

 

Seems a little nitpicky but when you have some complex jQuery stuff going on, you will notice a real performance difference.

 

Oh... as far as the "hide" class... using $("#divID").fadeIn(3000); will act the same as it does with inline styling.

NickforceNickforce

Another option for fading the page when saving or any other action would be to recreate the animated gif loading image that Salesforce uses on enhanced lists. I have wrote a example on how to do this.

 

http://nickforce.blogspot.com/2011/06/visualforce-actionstatus-component.html