Pure JS element resizing