Ghost/core/client/app/utils/set-scroll-classname.js
Kevin Ansfield 3d6856614f Use es6 across client and add ember-suave to enforce rules
no issue
- add ember-suave dependency
- upgrade grunt-jscs dependency
- add a new .jscsrc for the client's tests directory that extends from client's base .jscsrc
- separate client tests in Gruntfile jscs task so they pick up the test's .jscsrc
- standardize es6 usage across client
2015-11-30 10:41:01 +00:00

18 lines
661 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) {
let $target = options.target || this;
let {offset} = options;
let className = options.className || 'scrolling';
if (this.scrollTop() > offset) {
$target.addClass(className);
} else {
$target.removeClass(className);
}
}