javascript - Any way to bind event handler and call it at the same time? -
i have code following:
var f = function() {...}; $(window).resize(f); f(); as can see, i'd f called every time window resized, , f called once after make resize event handler.
is there way can make code shorter/more succinct? ideally i'd eliminate need f variable , make anonymous function (i.e. $(window).resize(function() {...}), need way of calling function once...
$(window). resize(function () {console.log("stop resizing me!");}). resize();
Comments
Post a Comment