updated example with resize event