javascript - How do I get the sidebar to move up -
i have page , want sidebar slide down user , works if on small screen 1024 * 768 not see bottom. here of code used make sidebar work. suggestions on how can change behavior.
$(window).scroll(function(){ sidebar_position(); }); $(window).resize(function(){ sidebar_position(); }); function sidebar_position(){ var w_width = ($(window).width() -1000) /2; $('#sidebar').css('left', w_width); var sidebar_height = $('#sidebar').outerheight(); var content_height = $('#widecolumn').outerheight(); var w_height = $(window).height(); if ( sidebar_height > w_height) { $('#sidebar').css('position', 'absolute'); } else { $('#sidebar').css('position', 'fixed'); }; if (sidebar_height > content_height) { content_height = sidebar_height; $('#widecolumn').css('min-height', content_height); }; if($.browser.msie && $.browser.version == 6 ){ $(window).scroll(function(){ $('#sidebar').css({ top: $(window).scrolltop() }); }) } }
i sort of lost of next....and how fix this
hm small screens problem either way since sidebar 600 px high on netbooks won't fit in browser window @ all.
but leave sidebar on position absolute until sidebar reaches top when scrolling , switch position fixed stays @ top of screen.
way use available screen height
Comments
Post a Comment