Here is an example of the code I want to control with jQuery (white bg button on bg black page):
<ul class="buttons"> <li class="button-displays"><a href="/products/">Products and Services for the company</a></li> <li class="button-packaging"><a href="/packaging/">Successful packaging services for the company</a></li> <li class="button-tools"><a href="/tools/">Data, mail and print tools for your company</li> </ul>
In the CSS file, I have the following:
.buttons li { background-image: url(images/sprite.png); height:126px; width:293px; float:left; margin:0 0 0 9px; } .button-displays { background-position: 0 125px; } .button-packaging { background-position: 0 250px; } .button-tools { background-position: 0 375px; }
I created these list items to look like buttons with buttons with a sprite background, helping fill the background of the buttons.
My client doesn't like that in Firefox and Safari, when the page loads for the first time, the text inside the anchor loads first, and then the li background sprite (which is about 150kb b / c. I have a total of 6 buttons) loads only when sprite is fully loaded. The background suddenly appears after several seconds of loading, leaving the text anchored itself until the background appears.
I tried playing with the following code in the hope that this would delay the loading of this markup and CSS:
$('.buttons li a').load(function() { });
and
$(window).load(function() { $(.buttons); });
I do not understand jQuery to find out if this code will wait until all the elements have loaded before they appear. I would rather make the list item elements in the button code linger on the page until bg img sprite is fully loaded.
Thanks for your help and suggestions!
micah source share