How to jQuery slidedown once page has already been loaded

為{幸葍}努か 提交于 2019-12-05 05:46:03

I tried mixing and matching using:

$(window).load(function()  

and

$(document).ready(function()  

but did not have any luck. I ended up using

 $(document).ready(function() {
    $(".MoreInfo").slideUp(1).delay(2000).slideDown('slow');

and that seemd to work. I think it had to do with the element already being displayed more than anything else.

You might want to try using

$(window).load(function() 

instead of

$(document).ready(function() 

as some of the elements you are trying to manipulate might not be completely loaded when $(document).ready fires.

Perhaps try body onload instead

$("body").load(function() {
    $(".MoreInfo").slideDown('slow');
});

...document.ready occurs as soon as the DOM can be manipulated, not necessarily once the page is displayed - it could be well before the page is displayed. You could also try putting this on a setTimeout call to allow a little extra time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!