Why not do it with CSS? where css class "tn-loading" has "display: none" declared
<div class="tn-hide tn-loading"> Content you are hiding until document "ready" </div> then $(document).ready(function() { //Do some stuff here //Done doing stuff, show the content $('tn-hide').removeClass('tn-loading); }); On Jan 16, 11:53 pm, "Christine Masters" <cmast...@townnews.com> wrote: > Hi everyone! > > I'm a jQuery newbie, so I apologize if this is an easy question! > > I'm building a template for newspaper sites, and by nature of having many > ads and modules and so forth, the content loads before the jQuery that > styles it, leading to a flash of unstyled content. > > So, on several of my modules that use a lot of jQuery, I'd like to hide them > until they are loaded. > > Right now, I'm trying to do this: > > $('tn-hide').css('display', 'none').addClass('tn-loading'); > > $(document).ready(function() { > $('tn-hide').css('display', 'block').removeClass('tn-loading); > > }); > > I'd like to be able to simply apply the 'tn-hide' class to any module I'd > like to hide until loaded on the page. > > It is my (limited) understanding that the first line will go into effect > when the DOM is ready and the second when the document is ready. > > Anyway, right now it isn't working. I'd appreciate it if you could give me > any insight on this or let me know if I'm heading in the right direction. > > If it helps, here is my page:http://blueprints.townnews-cms.com/ > > ---------------------------------------------------------------------------- > Christine Masters, Product Manager, TownNews.com > cmast...@townnews.com | 1-800-293-9576 x1022 > Twitter: c_masters > ----------------------------------------------------------------------------