Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-wheelie

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-wheelie

Mousewheel as an angular service

  • 3.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

angular-wheelie

Build Status Dependency Status Licence Coverage Status Bower version npm version

angular-wheelie exposes a service that allows you to bind wheel events to an angular element.

Installation

Install with bower:

bower install angular-wheelie

Or with npm:

npm install angular-wheelie

Or simply download the latest release.

Usage

The pre-built files can be found in the dist/ directory. dist/angular-wheelie.min.js is minified and production-ready. Example usage:

<script src="dist/angular-wheelie.min.js"></script>

Add wheelie to your app's module dependencies:

angular.module('myapp', ['wheelie']);

And now you can use the wheelie service in your controllers, directives, services etc. Example usage in a controller:

app.controller('MyController', [ '$scope', 'wheelie', function ($scope, wheelie) {
    var target = angular.element('#someElement');
    // To listen for wheel events:
    wheelie.bind(target, {
        up: function (event) {
            console.log('wheel up on element #someElement!');
            // to prevent scrolling, use event.preventDefault();
        },
        right: function (event) { // i.e. with a trackpad
            console.log('wheel right on element #someElement!');
        },
        down: function (event) {
            console.log('wheel down on element #someElement!');
        },
        left: function (event) { // i.e. with a trackpad
            console.log('wheel left on element #someElement!');
        }
    });
    // To unbind:
    $scope.on('$destroy', function () {
        wheelie.unbind(target);
    });
}]);

Not all callbacks are required, but at least one must be provided.

In the above example, all wheel events from #someElement will trigger one of the callbacks. To ignore wheel events from a nested element, pass the nested element's class-name as the third parameter:

app.controller('MyController', [ '$scope', 'wheelie', function ($scope, wheelie) {
    var target = angular.element('#someElement');
    var callbacks = { /* up, right, down, left callbacks */ };
    var classNameToIgnore = 'some-nested-elements';
    wheelie.bind(target, callbacks, classNameToIgnore);
}]);

Contributing

Contributions are welcomed! Here are the contribution guidelines.

First clone the repository and install dependencies:

npm install

To run tests:

npm test

To lint the code:

npm run lint

To make a production build:

npm run build

License

The MIT License

Keywords

FAQs

Package last updated on 06 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc