2.2.0 • Published 3 years ago

@arroyo/ngx-hoverscroll v2.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

Dependencies

Angular Support

VersionAngular Version
2.0.0 - 2.0.16-7
2.0.X, 2.1.X6-9
2.2.X>=10

No external dependencies other than Angular are required!

Installation

Install @arroyo/ngx-hoverscroll from npm:

> npm install @arroyo/ngx-hoverscroll

Setup

Follow the instructions below for adding ngx-hoverscroll to your Angular application:

  1. Add the Imports to your Module. For example, app.module.ts:

    import { HoverScrollModule } from '@arroyo/ngx-hoverscroll';
    ...
    
    @NgModule({
      ...
      imports: [HoverScrollModule.forRoot(), ... ],
      ... 
    })
  2. Add the hoverScroll Directive to Your Template:

    <div class="site-sidebar">
      <div class="site-sidebar-body" hoverScroll>
        <ul class="site-menu" data-plugin="menu">
           ...
        </ul>
       </div>
    </div>

At this time, only vertical scrolling is supported.

Demo App

A demo application is included. It is built with angular-cli. To run the demo install angular-cli and run:

> ng serve demo

The demo application is found in the demo/ directory inside projects.

Advanced Usage

The hoverScroll directive selects the immediate child as the "scrolled" content. The inner container should overflow the outer container in order to provide scrolling content.

One way to accomplish this is to set the outer container to be a max-height of the window and the inner container to contain it's natural height.

See the demo app for a working example.

Options

The directive takes the following inputs:

Input NameTypeDefaultDescription
scrollBuffernumber0Added buffer in pixels (vertically) on the top/bottom of the container in which scrolling will not occur.
stableBuffernumber25Tolerance in pixels (vertically) that the cursor must traverse before scrolling.
wheelMultipliernumber2Multiplier of delta change when scrolling with the mouse wheel.

The directive also exposes the following public methods:

MethodDescription
moveToTopMoves the scrollable content to the top of the parent view.
moveToBottomMoves the scrollable content to the bottom of the parent view.
moveToLastMoves the scrollable content to the last known Y-coordinate of the mouse.
moveTo(Y-coordinate)Moves the scrollable content to the given absolute Y-coordinate.
resetEnsures that the scrollable content is not out-of-bounds of the parent.
isScrollableReturns true if the content is scrollable (e.g. the inside content is larger than the outside content).

License

MIT License

Copyright (c) 2017 Arroyo Networks, LLC Copyright (c) 2020 Arroyo Networks, Inc.

2.2.0

3 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago