Ghost/core/client/app/utils/set-scroll-classname.js
Kevin Ansfield 3f361f8742 Standardize on var-less export default across ember app
no issue
- drops the `var Foo = Ember.Thing.extend({}); export default Foo;` syntax in favour of exporting directly, eg: `export default Ember.Thing.extend({})`
- discussion on this change [here](https://github.com/TryGhost/Ghost/pull/5340#issuecomment-105828423) and [here](https://github.com/TryGhost/Ghost/pull/5694#discussion-diff-37511606)
2015-10-06 10:59:50 +01:00

18 lines
666 B
JavaScript

// ## scrollShadow
// This adds a 'scroll' class to the targeted element when the element is scrolled
// `this` is expected to be a jQuery-wrapped element
// **target:** The element in which the class is applied. Defaults to scrolled element.
// **class-name:** The class which is applied.
// **offset:** How far the user has to scroll before the class is applied.
export default function (options) {
var $target = options.target || this,
offset = options.offset,
className = options.className || 'scrolling';
if (this.scrollTop() > offset) {
$target.addClass(className);
} else {
$target.removeClass(className);
}
}