Working legends and div resize