Javascript + onresize event -


why can't add multiple instances of onresize window element? instance, second onresize event (tire) trace log:

var windowresize = {       fire : function(){ window.onresize = function(){ console.log('fire') }},   tire : function(){ window.onresize = function(){ console.log('tire') }} } windowresize.fire(); windowresize.tire(); 

@hemant absolutely correct.

another version of code in pure javascript this.

var windowresize = {       fire : function(){ window.addeventlistener('resize', function(){console.log('fire');}, false);},   tire : function(){ window.addeventlistener('resize', function(){console.log('tire');}, false);} }   windowresize.fire(); windowresize.tire(); 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -