You need to sign in to do that
Don't have an account?
sahi
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.
Did you include the JQuery library on your page? You are using JQuery constructs there, but without the JQuery library they will not work.
I have uploaded the jQuery library in static resources
and I am using that in page by the includeScript.
And why do you have the
$(document).ready(function () {
twice?
I am new to Java Script and I have seen that code in search for fading the page onload.
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.
Ya I got it.
I am very thank ful for your reply...
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.
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