jQuery and setTimeout

后端 未结 4 1626
粉色の甜心
粉色の甜心 2021-01-27 02:37

I have the following code:

            jQuery(document).ready(function()
            {
setTimeout($(\'#loading\').fadeIn(\'slow\'), 9999);
            });
         


        
4条回答
  •  攒了一身酷
    2021-01-27 02:59

    setTimeout accepts a function as first parameter - you are currently passing a jQuery selector, which immediately gets evaluated which executes the fadeIn operation. Instead pass in an anonymous function:

    setTimeout(function() {
     $('#loading').fadeIn('slow'), 9999);
    }, 9999);
    

提交回复
热议问题