Why wouldn't you use $(fn) here instead of $(document).ready(fn)?

Adam




Karl Swedberg-2 wrote:
> 
> 
> $(document).ready(function() {
>    $('#wrapper p').hide()
>    $('#wrapper h2').filter(':even').css('backgroundColor',  
> '#ef0000').end().filter(':odd').css('backgroundColor', '#0000ef').end 
> ().css({cursor: 'hand', cursor: 'pointer', color: '#fff'}).click 
> (function() {  $(this).siblings('p').slideToggle('slow');  });
> });
> 
> Or, to make it more readable:
> 
> $(document).ready(function() {
>    $('#wrapper p').hide()
>    $('#wrapper h2')
>    .filter(':even')
>      .css('backgroundColor', '#ef0000')
>    .end()
>    .filter(':odd')
>      .css('backgroundColor', '#0000ef')
>    .end()
>    .css({cursor: 'hand', cursor: 'pointer', color: '#fff'})
>    .click(function() {
>      $(this).siblings('p').slideToggle('slow');
>    });
> });
> 
> 
> --Karl
> _________________
> Karl Swedberg
> www.englishrules.com
> www.learningjquery.com
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Some-jQuery-tips-and-tricks-tf3219479.html#a9002620
Sent from the JQuery mailing list archive at Nabble.com.


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

Reply via email to