Cufon toggle css visibility with jQuery fails only in IE8
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/p开发者_如何学JAVAlugins/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>
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.
精彩评论