On May 1, 10:25 am, bluejohn <john.car...@bluefly.com> wrote: > Hi, > > I'm running an A/B test using a 3rd party javascript testing app. I'm > loading the jquery script with the tool. > > <script> > $(document).ready(function(){ > $(".cartInStock").css({display : " none "}); > }); > </script> > > The problem is that the original CSS displays (what I want to hide) > while the page is loading, but as soon as it finishes the the script > updates the css and the element disappears. > > The script itself loads fairly high up on the page. I'm not sure if > this is the script or the A/B testing tool causing the delay. > > Any suggestions?
It depends on the size of your document. The function you passed to ready() will be executed only after the whole DOM has loaded, if your page is long it's likely that you'll have a delay. See here for a practical alternative (ignore the fancy title): http://www.learningjquery.com/2008/10/1-awesome-way-to-avoid-the-not-so-excellent-flash-of-amazing-unstyled-content