jquery-pseudo-class

0.1.8 • Public • Published

jQuery pseudo-class

Add pseudo-class events control to jQuery

Install

npm install --save jquery-pseudo-class

🚧 The module is still in development. The following pseudo-classes are supported:

  • active
  • hover
  • ... work in progress ...

Usage

$elem.onPseudoClass( pseudo_class, function_in, function_out );
 
$elem.onPseudoClass( {
    pseudo_class: [function_in, function_out],
    pseudo_class: [function_in, function_out],
    ...
} );

For exemple:

var $elem = $('.js-button');
 
$elem.onPseudoClass('hover',
    function(e) {
        $elem.html('Mouse is in');
    },
    function(e) {
        $elem.html('Mouse is out');
    }
);

Or

var $elem = $('.js-button');
 
$elem.onPseudoClass({
    hover: [
        function(e) {
            $elem.html('Mouse is in');
        },
        function(e) {
            $elem.html('Mouse is out');
        }
    ],
    active: [
        function(e) {
            $elem.html('Mouse pressed');
        },
        function(e) {
            $elem.html('Mouse released');
        }
    ]
});

Licence

This plugin is under the Apache 2.0 Licence. Please refer to the LICENCE file for more details.

Made with ❤️ in Paris

Package Sidebar

Install

npm i jquery-pseudo-class

Weekly Downloads

3

Version

0.1.8

License

Apache-2.0

Last publish

Collaborators

  • ncoden