jQuery ready function
        Posted  
        
            by Darren Tarrant
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Darren Tarrant
        
        
        
        Published on 2010-06-18T08:56:25Z
        Indexed on 
            2010/06/18
            9:03 UTC
        
        
        Read the original article
        Hit count: 404
        
JavaScript
|jQuery
Can anyone tell me why the document ready function needs a call to function first please? I've been told that the setTimeout in the first below example (which does not work) would be evaluated and passed to ready, but I don't see what the difference would be for the function call in the second example (which works)?
$(document).ready(
    setTimeout(
        function(){
            $('#set_3').innerfade({
                animationtype: 'fade',
                speed: 'slow',
                timeout: 3000,
                type: 'sequence',
                containerheight: '180' });
        },
        2000);
);
$(document).ready( 
    function(){  
        setTimeout(
            function(){ 
                $('#set_3').innerfade({  
                    animationtype: 'fade',
                    speed: 'slow', 
                    timeout: 3000, 
                    type: 'sequence', 
                    containerheight: '180' }); 
            }, 
            2000);
    }
);
?
© Stack Overflow or respective owner