Plugin to set a class on the first visible element of a class. Options are:
watchClass: false, // what class are we looking for ( needs to be set ) activeClass: 'topElement', // class to add to found el. callback: false, // function to call on change, is passed (null, current hilighted el, el about to be hilighted) showRatio: 1, // what percent of us can be off-screen and still count as "visible" ? 0 = we are not "visible" once ANY part is offscreen. // .5 = half of us can be off screen and we still count as "Visible" // 1 = as long as one pixel is onscreen, we are "visible" padValue: 0 // padding in px you may want to add to visiblity calculations
This page is using: jQuery().getFirstVisible({ watchClass: 'activity', showRatio: 0.75 });