exited the each loop when the height is ok
used the cached variable instead of querying again the dom