Adaptive height on next/prev and onload