Hi,

>       $(document).ready(function() {
>  // hides the slickbox as soon as the DOM is ready
>  // (a little sooner than page load)
>   $('#slickbox').hide();
>
>    });
>
>  // toggles the slickbox on clicking the noted link
>   $('a#slick-toggle').click(function() {
>     $('#slickbox').toggle(400);
>     return false;
>
> });

try it this way:

$(document).ready(function() {
  $('#slickbox').hide();
  $('a#slick-toggle').click(function() {
    $('#slickbox').toggle(400);
    return false;
  });
});

Then the Element behind $('a#slick-toggle') does exist when you try to use it.

BTW.: If you are shure, that the id "slick-toggle" is alway a <a>-element, you 
will be off better with $('#slick-toggle'). In that case jQuery can simply 
use document.getElementById(). I am not shure about jQuery 1.1, but older 
Versions with $('a#slick-toggle') would search the whole document tree for 
<a>-tags and check if they have the given id. That is of course a lot slower.

You can even spare another jquery query, but don't expect too much speed up 
from that:

$(document).ready(function() {
  var sl = $('#slickbox').hide();
  $('a#slick-toggle').click(function() {
    sl.toggle(400);
    return false;
  });
});

Since you already use an id here, the second query doesn't really take much 
time.

Christof

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to