Shorten JS code --animations resizingbug