I have a function foo()
and want to call it in three times as below
function foo() {
// function code goes here
}
foo();
$(window).resize(function() {
setTimeout(function(){foo();}, 300);
});
$('#div').scroll(function() {
setTimeout(function(){foo();}, 300);
});
I want to know if there is any short way to call it in all three situations.