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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -