2.0.0 • Published 7 years ago

ember-scroll-to-mk2 v2.0.0

Weekly downloads
133
License
MIT
Repository
github
Last release
7 years ago

ember-scroll-to-mk2

Travis npm Ember Observer Score 1.13+

A link/button component that performs scrolling to given selector.

Current implementation uses jQuery for animated scrolling (animation is optional).

See: demo, API docs.

Reimplementation of ember-scroll-to

This project is a reimplementation of ember-scroll-to by @jasonkriss and other contributors.

Differences:

  • ember-scroll-to-mk2 only provides the component, not the service.
  • Scrolls to any selector, not just id.
  • Allows specifying which container to scroll.
  • Optional caching of container and target elements -- disable caching if your app has them disappearing/reappearing.

Installation

ember install ember-scroll-to-mk2

Usage

Inline form:

{{scroll-to
  target = "#foo"
  label  = "Scroll to #foo"
}}

Block form:

{{#scroll-to
  target = "#foo"
}}
  <strong>Scroll to #foo"</strong>
{{/scroll-to}}

Arguments

ArgumentTypeDefault valueDescription
labelundefined/StringundefinedIf no block is provided, this is used as link/button label.
targetString\Selector of the element to scroll to
scrollableString'html, body'Selector of the element being scrolled. In test env, '#ember-testing-container' is used.
durationundefined/NumberundefinedAnimation duration in milliseconds. When undefined, jQuery's default is used.
easingundefined/StringundefinedAnimation easing name. When undefined, jQuery's default is used.
offsetNumber0Lets you scroll slightly above or below the target.
cacheTargetBooleantrueWhether to cache the target element.
cacheScrollableBooleantrueWhether to cache the scrollable element.
afterScrollundefined/ActionundefinedEmber Action to invoke every time scrolling animation completes.
shouldAccountForScrollableBooleanfalse if scrollable is not defaultWhether to account for scollable's offset and scolllTop when calculating scolllTop.

License

This software is free to use under the MIT license. See the LICENSE file for license text and copyright information.

Includes fragments of code borrowed from jasonkriss/ember-scroll-to.