Archive for April, 2008

Useful jQuery

Wednesday, April 23rd, 2008 | 9 Comments

I’ve compiled a pretty good list of useful jQuery scripts that I bookmarked over some time and also used in a few projects over at the DevKick blog. Worth a visit: Useful jQuery: a Compilation of jQuery Utilities

3 Kärlekar

Wednesday, April 23rd, 2008 | 10 Comments

I made a new poster:

3 love

Avoiding Flickering in jQuery

Sunday, April 13th, 2008 | 22 Comments

Ok, so you have an expandable list that works nice in jQuery, but as you add more code and graphics to your HTML document, chances are that the onDomReady() becomes too slow and you’ll see a familiar flicker before the jQuery kicks in. In your case, the entire list will be shown for a millisecond before the DOM is fully loaded and the list contracts. One way of avoiding this is dirty but surprisingly easy:

  1. document.write('<style type="text/css">body{display:none}</style>');
  2. jQuery(function($) {
  3. $('body').css('display','block');
  4. });

The document.write looks ugly, but it actually works really well in this case. First hide the body via a direct style injection through javascript, and then show it onDomReady. Flicker-free!