This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/mixins/scrolling.js

25 lines
630 B
JavaScript

/* Use this mixin if you want to be notified every time the user scrolls the window
*/
(function() {
window.Discourse.Scrolling = Em.Mixin.create({
bindScrolling: function() {
var onScroll,
_this = this;
onScroll = Discourse.debounce(function() {
return _this.scrolled();
}, 100);
jQuery(document).bind('touchmove.discourse', onScroll);
return jQuery(window).bind('scroll.discourse', onScroll);
},
unbindScrolling: function() {
jQuery(window).unbind('scroll.discourse');
return jQuery(document).unbind('touchmove.discourse');
}
});
}).call(this);