jQuery: fade div in and out multiple times
问题 I have a div at the top of a page that I would like to fade in and out 3 times. I found a question/answer already that shows how to fade with an infinite loop by putting the fade effects in a function that calls itself, but I was wondering what the best way to specify a finite number of fade cycles. So far, this is what I have (stolen from another StackOverflow post): function fade() { $("#notification").animate({opacity: 1.0}, {duration: 500}) .animate({opacity: 0}, {duration: 500}) .animate