created a resize event - although not entirely sure whether im doing it right