Get the visible height of a div with jQuery
Calculate the amount of px an element (height) is in viewport Fiddle demo This tiny function will return the amount of px an element is visible in the (vertical) Viewport: function inViewport($el) { var elH = $el.outerHeight(), H = $(window).height(), r = $el[0].getBoundingClientRect(), t=r.top, b=r.bottom; return Math.max(0, t>0? Math.min(elH, H-t) : Math.min(b, H)); } Use … Read more