Check if element is visible for certain percentage on screen (viewport)?
javascript, jquery
Solution
Jquery.fracs plugin seems to do exactly what you need.
function callback(fracs: Fractions, previousFracs: Fractions) {
if(fracs > 0.5)
doSomething();
};
var fracs = $("img").fracs(callback);
Problem
How can i detect if some element is visible? For better understading look at the image below. I want to fire event when the image is half-visible. It would be great if it would work for all browsers and devices (tablets and smartphones).