update js for more elegant positioning of the sidebar