I'd like to test whether a certain div is visible on screen. Once it is visible, I'd like the divs around it to change background color.
Here is what I currently have: http://jsfiddle.net/4y9f2574/1/
if ($('.onscreen').isOnScreen()) {
$('.box').css('background','green');
}
Any idea why the blue boxes aren't changing to green when the orange box is visible?
Thanks! Lauren
There is nothing in your fiddle with class
onscreen. Did you mean to write.boxinstead? Like: