javascript - jquery - how to continue the execution of one function once another function has returned a value -
i have function called showauthorinfo performs animation, , executes other code logic once animation finished: self.showauthorinfo = function(){ var authorid = $authorlink.attr('data-author-id'); //pl-int - determine info needs captured here var isactive = $modalinfowindow.hasclass('active'); self.$modalinfowindow.animate({ 'bottom': '0px' },200,function(){ self.$modalinfowindow.addclass('active'); self.loadauthorinfo(authorid); }) } however, because want show , hide modal window via various function calls, executing different callbacks each time animation completed, i'd wrap animation function. question is, can use above function call custom function animation happens, , have animation function return value function, whereon can proceed? i break function multiple functions, feel complicated, because have pass on function-specific parameters wouldn't apply cases (for example, in code above, if going call anima