jQuery .animate() callback infinite loop

前端 未结 5 890
我在风中等你
我在风中等你 2021-02-10 23:54

A simple question: Why can I do this

var start = function() {
    $(\'#element\').animate({}, 5000, \'linear\', start);
}

but not this

5条回答
  •  我寻月下人不归
    2021-02-11 00:47

    it's because in the first one you are sending the namespace of the function, when you add the () to the end of the function name it executes the function immediately

提交回复
热议问题