Skip to content

Instantly share code, notes, and snippets.

@protodave
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save protodave/a71be73cd8e499c0b169 to your computer and use it in GitHub Desktop.
Save protodave/a71be73cd8e499c0b169 to your computer and use it in GitHub Desktop.
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