use $(window).height() instead of $figure.height()