Run a “then” function as an “each jQuery” call is completed. The worse way to do it is to have a setTimeout delay before to call the function you wish. The good way to do it is to use promise to set a callback after all asynchronous each loop are completed.
Sometimes you want an action to happen only when the user clicks. For instance, I had a rollover effect going trigger the same action as a click on filter button. However, if the button is clicked I wanted to avoid rollover to change the selected filter to keep the selected filter active. So if the user clicks, I run the trigger, if not I don’t run it.