Javascript library to fit a child element into a parent element