javascript - Why is this on('resize') event triggered at load and not on window resize? -


i have following code wrapped in $(document).ready(function(){});:

var sizemapcontainer = function(n) {     var w = $(window).innerheight();     var h = $('#sl-header-container').outerheight();     var f = $('.oev-form-container').outerheight();     var m = w - h - f;    $('#map-container').outerheight(m); } sizemapcontainer(1); $(window).on('resize', sizemapcontainer(2)); 

why sizemapcontainer gets called twice when page loads not when resize window?

you're calling function, not binding event function. should be:

$(window).on('resize', function() {     sizemapcontainer(2); }); 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -