0

I'm using jQuery along with cufon font replacement. Its been working great, however, I'm working on script to eliminate the FOUC (flash of unstyled content) issue on slower connections.

To do this, I'm using css to toggle the visibility of the cufon replacement elements to "hidden", then at the end of the document, I have a call to jQuery to toggle visibility back on.

This works great in all browsers I've tested against, except IE8

Any ideas what would cause IE8 to have problems with this script?

<script src="mythemelocation/js/cufon-yui.js" type="text/javascript"></script>
<script src="wp-content/plugins/fonts/Delicious_500-Delicious_700-Delicious_italic_500-Delicious_italic_700.font.js" type="text/javascript"></script>
<script src="wp-content/plugins/fonts/League_Gothic_400.font.js" type="text/javascript"></script>
<script src="wp-content/plugins/fonts/Vegur_400-Vegur_700.font.js" type="text/javascript"></script>
<script type="text/javascript">Cufon.set('fontFamily', 'League Gothic').replace('h1')('h2')('h4')('.siteTitle')('.tagline');</script>  
<script type="text/javascript"> Cufon.now(); </script>  
<script type='text/javascript'>jQuery(document).ready(function(){jQuery('#accordion-1, .siteTitle,.posttitle,.tagline,h4').css('visibility', 'visible');});</script>
</body>

1 Answer 1

0

Use .show() instead of .css('visibility', 'visible').

So your script would look like this:

jQuery(function($){$('#accordion-1,.siteTitle,.posttitle,.tagline,h4').show()});

Also you don't need to write 3 <script> elements for your inline scripts.

3
  • thanks for the help. I'm toggling visibility off with standard css in the head of my document, not using jQuery hide(). In that case, when I use .show() nothing happens.
    – Scott B
    Commented May 25, 2011 at 15:55
  • Try display:none instead of visiblity:hidden in your css.
    – jantimon
    Commented May 25, 2011 at 16:00
  • I'm using visibility instead of display in order to retain the layout dimensions of the placeholder elements that are being manipulated.
    – Scott B
    Commented May 25, 2011 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.