Hello, friends!
JQuery has two event handlers for the window: resizing the screen (resize) and scrolling. How to make the event (in the particular case - the assignment of a variable to the height of the block with id) processed by any of the actions? I understand that you can just write the code twice, but I think there is some more beautiful solution?
$(window).resize(function() { nav_height = $('#stick_menu').height(); }); $(window).scroll(function() { nav_height = $('#stick_menu').height(); });