npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fpmk-ngx-perfect-scrollbar

v5.0.3

Published

Angular wrapper library for Perfect Scrollbar

Downloads

2

Readme

Angular Perfect Scrollbar

This is an Angular wrapper library for the Perfect Scrollbar. To use this library you should get familiar with the Perfect Scrollbar documentation as well, this documentation only explains details specific to this wrapper.

See a live example application here.

Library building

npm install
npm run build
npm run inline

Library development

npm link
cd example
npm link ngx-perfect-scrollbar

Running the example

cd example
npm install
npm start

(or 'npm run start:sjs' for using SystemJS)

Installing and usage

npm install ngx-perfect-scrollbar --save
Load the module for your app (with global configuration):
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
import { PerfectScrollbarConfigInterface } from 'ngx-perfect-scrollbar';

const PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
  suppressScrollX: true
};

@NgModule({
  ...
  imports: [
    ...
    PerfectScrollbarModule.forRoot(PERFECT_SCROLLBAR_CONFIG)
  ]
})
Use it in your HTML template (with custom configuration):

This library provides two ways to create a Perfect Scrollbar element, a component and a directive. Component tries to make the usage as simple as possible and the directive is meant for more custom / advanced usages. The scroll area always needs some fixed height to work. The default styles uses 100% as the height value so the parent needs to have fixed height or you need to set it via CSS styles. Otherwise the height keeps growing and you won't get the scrollbars.

COMPONENT USAGE

Simply replace the element that would ordinarily be passed to Ps.initialize with the perfect-scollbar component.

<perfect-scrollbar class="container" [config]="config">
  <div class="content">Scrollable content</div>
</perfect-scrollbar>
[config]                // Custom config to override the global defaults.

[disabled]              // Disables the perfect scrollbar initialization.

[usePSClass]            // Use ps class (needed by the ps theme styles).

[autoPropagation]       // Automatic swipe and wheel propagation control.
[scrollIndicators]      // Enable fading edges scroll indicators showing.

(<ps-event-name>)       // All perfect scrollbar events work as bindings.

DIRECTIVE USAGE

When using only the directive you need to provide your own theming or import the default theme:

@import '~perfect-scrollbar/css/perfect-scrollbar.css';

Perfect scrollbar directive should be used with div elements and can take optional custom configuration:

<div [perfect-scrollbar]="config"></div>
[perfect-scrollbar]     // Can be used to provide optional custom config.

[disabled]              // Disables the perfect scrollbar initialization.

[usePSClass]            // Use ps class (needed by the ps theme styles).
[psPosStyle]            // Position style (controls scrollbar placement).

(<ps-event-name>)       // All perfect scrollbar events work as bindings.
Available configuration options (custom / global configuration):
wheelSpeed              // Scroll speed for the mousewheel event (Default: 1).
wheelPropagation        // Propagate wheel events at the end (Default: false).
swipePropagation        // Propagate swipe events at the end (Default: true).
minScrollbarLength      // Minimum size for the scrollbar (Default: null).
maxScrollbarLength      // Maximum size for the scrollbar (Default: null).
useBothWheelAxes        // Always use the both wheel axes (Default: false).
suppressScrollX         // Disable X axis in all situations (Default: false).
suppressScrollY         // Disable Y axis ni all situations (Default: false).
scrollXMarginOffset     // Offset before enabling the X scroller (Default: 0).
scrollYMarginOffset     // Offset before enabling the Y scroller (Default: 0).
stopPropagationOnClick  // Stop the propagation of click event (Default: true).

For more detailed documentation with all the supported events / options see the Perfect Scrollbar documentation.

Available control / helper functions (provided by the directive):
update()                        // Updates the scrollbar size and position.
geometry(property)              // Returns the geometry for specified property.
scrollable(direction)           // Checks if the given direction is scrollable.
                                // Direction can be: 'any','both','x','y'

scrollTo(x, y, speed)           // Animate scroll to given x,y coordinates.
scrollToY(position, speed)      // Animate scroll to given vertical position.
scrollToX(position, speed)      // Animate scroll to given horizontal position.
scrollToTop(offset, speed)      // Animate scroll to given offset from the top.
scrollToLeft(offset, speed)     // Animate scroll to given offset from the left.
scrollToRight(offset, speed)    // Animate scroll to given offset from the right.
scrollToBottom(offset, speed)   // Animate scroll to given offset from the bottom.

Above functions can be accessed through the directive reference (available as directiveRef in the component).