Created
July 3, 2014 18:11
-
-
Save lafikl/d8da6e217e5c5f1c0cc8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var el = document.getElementById('head'); // caching it for better performance | |
var steady = new Steady({ | |
throttle: 100, | |
handler: function(el, done) { | |
console.log('woo!'); | |
// this important to tell Steady that you finished processing so it can call you later | |
done(); | |
} | |
}); | |
steady.addTracker('is-visible-head', function(){ | |
var rect = el.getBoundingClientRect(); | |
return ( | |
rect.top >= 0 | |
&& rect.left >= 0 | |
&& rect.top <= (window.innerHeight || document.documentElement.clientHeight) | |
); | |
}); | |
steady.addCondition('is-visible-head', true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OK - I think I've been confused about what the
tracker
is vs thecondition
.Current code - no events still fire.