开发者

How do I hide a div before the page is loaded?

开发者 https://www.devze.com 2023-01-09 18:44 出处:网络
I have a div on my page - I\'d like when that page is being 开发者_如何学运维loaded that Div is being hidden by jQuery\'s .hide method. Now I have that when a page is ready then that div is hiding - b

I have a div on my page - I'd like when that page is being 开发者_如何学运维loaded that Div is being hidden by jQuery's .hide method. Now I have that when a page is ready then that div is hiding - but that hiding is visible. I don't want that

Now I have that code:

$(document).ready(function(event)
{            
   $('#Div1').hide('fast');
});


.hide('fast') will still animate. To do it (nearly) instantly use .hide();. However, you may still see a flicker, in which case what you want to do is append

style="display:none" 

to the element in question as part of the initial html sent. This still allows you to use jQuery's .show(); method later on if you wish.

0

精彩评论

暂无评论...
验证码 换一张
取 消