javascript - jQuery get a change of div height after load -


when scroll, need #sidebar fixed between header , footer, have code works works well.

the problem when in #content there div display:none showed activating radio buttons, in case #content height change, code followed doesn't change.

$(document).ready(function () {     var length = $('#content').height() - $('#sidebar').height() + $('#content').offset().top;     $(window).scroll(function () {         var scroller = $(this).scrolltop();         var height = $('#sidebar').height() + 'px';         if (scroller < $('#content').offset().top) {             $('#sidebar').css({                 'position': 'absolute',                     'top': '0'             });         } else if (scroller > length) {             $('#sidebar').css({                 'position': 'absolute',                     'bottom': '0',                     'top': 'auto'             });         } else {             $('#sidebar').css({                 'position': 'fixed',                     'top': '0',                     'height': height             });         }     }); }); 

how can #content height change after load?


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -