Ghost/ghost/admin/utils/set-scroll-classname.js
David Arvelo e88519613f Add shadows to PostsListView and the adjacent HTML Preview; Fix preview render
closes #2906
- add a utility function to add classnames to targets, retrofitted from clientold to accommodate `Ember.run.bind`
- create a content-preview view that tracks its scrolling
- add a scroll handler to the existing PostsListView
- The `posts/post` template now takes its HTML from the post model instead of using the editor's markdown component
2014-06-08 12:53:54 -04:00

20 lines
713 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.
var setScrollClassName = 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);
}
};
export default setScrollClassName;