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

ng-tiny-scrollbar

v0.10.1

Published

An angular directive port of the TinyScrollbar

Downloads

174

Readme

ngTinyScrollbar

An angular directive port of the TinyScrollbar See simple demo

How to use

Install using bower

bower install ng-tiny-scrollbar --save

Install using npm

npm install ng-tiny-scrollbar --save

Add css and javascript to your site

<link rel="stylesheet" href="bower_components/ng-tiny-scrollbar/dist/ng-tiny-scrollbar.css" type="text/css"/>
<script src="bower_components/ng-tiny-scrollbar/dist/ng-tiny-scrollbar.js"></script>

Add the ngTinyScrollbar module as a dependency of your application

Mark any item you want custom scrollbars on with the scrollbar attribute.

<div id="myCustomScrollbarContainer" scrollbar>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vel metus sed
    ipsum facilisis ornare. Vestibulum mattis rutrum sem. Phasellus ullamcorper nisi
    vel enim lobortis lacinia. Vestibulum eu dui ligula. Sed nibh velit, faucibus sed
    feugiat ac, fermentum sed sem. Vestibulum porttitor neque nec urna tincidunt, vel
    lobortis nibh tempor. Aliquam ac ex ante. Aenean quis dolor id nunc maximus venenatis.
</div>

Add a width and a height in your css for the .scroll-viewport underneath your item. Ensure your container has a width that's slightly larger than the viewport otherwise the scrollbar will be overtop of your content

#idCustomScrollbarContainer {
  width: 120px;
}

#idCustomScrollbarContainer .scroll-viewport {
    height: 200px;
    width: 100px;
}

Specify options via the attribute value. You can use scope properties for any of the values

<div scrollbar="{axis: 'y', wheel: false}"></div>

Here's the list of all the options and the default values

{
    axis : 'y',             // Vertical or horizontal scrollbar? ( x || y ).
    wheel : true,           // Enable or disable the mousewheel;
    wheelSpeed : 40,        // How many pixels must the mouswheel scroll at a time.
    wheelLock : true,       // Lock default scrolling window when there is no more content.
    scrollInvert : false,   // Enable invert style scrolling
    trackSize : false,      // Set the size of the scrollbar to auto or a fixed number.
    thumbSize : false,      // Set the size of the thumb to auto or a fixed number.
    alwaysVisible: true,    // Set to false to hide the scrollbar if not being used
    autoUpdate: false       // Autoupdate the scrollbar if DOM changes. Needs MutationObserver or a polyfill to be available
}

These can also be set up via the scrollbarProvider. e.g.

myApp.config(['scrollbarProvider', function(scrollbarProvider) {
  scrollbarProvider.defaults.autoUpdate = true;
}]);

These defaults will be available to all scrollbars in your app.

Customizing appearance

Build using the less file and specify the following variables:

@scrollbar-width: 15px;         // width of the scrollbar;
@scrollbar-color: lightgray;    // color of the scrollbar
@scroll-thumb-color: gray;      // color of the thumb
@scroll-border-radius: 5px;     // border radius, set to 0 for square scrollbar and thumb

Autoupdate on DOM changes

The scrollbar supports updates on DOM changes. This needs to be enabled in the options:

<div scrollbar="{autoUpdate: true}"></div>

In order for this to work, MutationObserver or a polyfill must be available. See here which browsers are supported.

License

The MIT License (MIT)

Copyright (c) 2014 Vadim Kazakov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.