setTimeout — callback executed immediately? [duplicate]
问题 This question already has answers here : Why is my function call that should be scheduled by setTimeout executed immediately? [duplicate] (3 answers) Closed 5 years ago . I want to let an element fade in, and stay on the page for 7 seconds before it fades out. And I can cancel it anytime. I defined the following functions. But when I called info_timeout.setup(ele, 'some msg here') , the ele just faded in and faded out immediately. Am I missing something? var info_timeout = { show_info: