Last active
August 29, 2015 14:12
-
-
Save protodave/a71be73cd8e499c0b169 to your computer and use it in GitHub Desktop.
This file contains 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
views/main/main.js | |
Template.main.rendered = function () { | |
$('body').scroll(function() { | |
var scrollTop = $(window).scrollTop(); | |
// Do something now with this change here directly... | |
// :TODO: | |
// and/or save to Session so we can use it reactively | |
Session.set('scrollTop', scrollTop); | |
); | |
}; | |
--- | |
client.js | |
Tracker.autorun(function () { | |
var scrollTop = Session.get('scrollTop'); | |
// Do stuff with this reactive scrollTop value | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment