mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-05 18:34:39 +03:00
3d6856614f
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
18 lines
661 B
JavaScript
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);
|
|
}
|
|
}
|