Changed .attr('offsetHeight') to [0].offsetHeight