Click here to Skip to main content
15,899,314 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
The jquery Silde $("#divhome").slideDown(2000); is working inside the Onclick function. But the Same is not working inside the window load function.

C#
$(window).load(function(){
	$('#divhome').load('home.html');          //Load  home Div
	$("#divhome").slideDown(2000);          //Silde  home Div
	$('#divgallery').load('gallery.html');          //Load  Gallery Div
	$('#divabout').load('about.html');          //Load  AboutUs Div
	$('#divcontact').load('contact.html');          //Load  Contactus Div
  });



Kindly help..

Thanks in Advance
Santhosh
Posted
Updated 12-Jul-11 20:16pm
v2
Comments
Sunasara Imdadhusen 13-Jul-11 2:17am    
added PRE tag!

you can use like

C#
jQuery(document).ready(function () { 
   $('#divhome').load('home.html');        //Load  home Div
   $("#divhome").slideDown(2000);          //Silde  home Div
   $('#divgallery').load('gallery.html');  //Load  Gallery Div
   $('#divabout').load('about.html');      //Load  AboutUs Div
   $('#divcontact').load('contact.html');  //Load  Contactus Div
}
 
Share this answer
 
Comments
LSanthosh 13-Jul-11 2:54am    
Thank you very much but this works in IE but in Chrome and firefox. It is not working. The home div just appears and it does not silde.. Kindly help
Sunasara Imdadhusen 13-Jul-11 2:59am    
Is there any error?
LSanthosh 13-Jul-11 3:01am    
No there is no error, but the div loads with one sec delay.
Sunasara Imdadhusen 13-Jul-11 3:09am    
but how could you know there is no error?
If you are using FF then go Tools > Error console or
If IE then Status bar > left hand side will display Error icon > Double click it will open popup with error message if exists.
LSanthosh 13-Jul-11 3:19am    
Yes you are right. There is a error in Firefox Error Console..
Error: Components.classes['@mozilla.org/oji/jvm-mgr;1'] is undefined
Source File: chrome://javaconsole1.6.0_26/content/ffjcext.js
Line: 33
Atlast My Self found the solution. The solution is jquery Slide will work only after the sliding element completely loads. Hence the slide function must be given in the callback method of the load function.

C#
$(window).load(function(){
	$('#divhome').load('home.html', function() {           //Load  home Div
		$('#divhome').slideDown(2000);}              //Silde  home Div
	);
	$('#divgallery').load('gallery.html');          //Load  Gallery Div
	$('#divabout').load('about.html');          //Load  AboutUs Div
	$('#divcontact').load('contact.html');          //Load  Contactus Div
  });
 
Share this answer
 
v2

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



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