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

jquery.transition

v0.1.0

Published

A custom jQuery event that executes user-defined callback functions during an elements CSS transition.

Downloads

6

Readme

jquery.transition

A custom jQuery event that executes user-defined callback functions during an elements CSS transition.

Demo

See the demo here.


Dependencies

jquery.transition is dependent on jQuery version 1.8.4+.


Installation

Manual installation

Reference the file in your project:

<script src="js/jquery.transition.js"></script>
Using Bower
bower intsall jquery.transition
Using NPM
npm install jquery.transition --save-dev

Options & Usage

Just as a heads up: There is also working example of how to use the plugin in the repo.

Options:

All options are set as the second parameter of the jQuery event-binding method .on(...). For more info on this method, read the documentation on jQuery'r website. As an example:

$(selector).on('transition', {

  // options.start - This method is executed when the element
  // begins transitioning, and is only executed once per
  // transition property
  // ***
  // Parameters:
  //   property[string] - the value of the CSS property that began to transition
  start : function( property ) {
    // ...
  },

  // options.progress - This method after the element has
  // begun transitioning, and fires every 15ms until
  // the transition is complete.
  // ***
  // Parameters:
  //   property[string] - the value of the CSS property that is currently transitioning
  //   duration[integer] - the amount of time, in milliseconds, since the transition started
  //   value[float|integer|string] - the current value of the CSS property currently transitioning
  progress : function( property, duration, value ) {
    // ...
  },

  // options.complete - This method is executed once
  // the transition has completed.
  // ***
  // Parameters:
  //   property[string] - the value of the CSS property that finished transitioning
  complete : function( property ) {
    // ...
  }
},

  // Event Callback - This callback function is
  // executed after all initial CSS transition-property
  // values have completed their transition phase. If
  // the event is unbound prior to that moment, this
  // callback will never be executed.
  // ***
  // Parameters:
  //   event[jQuery Event] - The default jQuery Event created during during initial setup
  function( evt ) {
    // ...
});
Basic usage:

Add the transition property values in your CSS:

.box {
  height: 250px;
  width: 250px;
  opacity: 0.75;
  transition: 2000ms ease-in-out width 0ms, 1000ms ease-out opacity 250ms;
}
.box.active {
  width: 500px;
  opacity: 0;
}

Bind the event:

$('.box').on('transition', {
  start : function( property ) {
    console.log( 'started', property );
  },
  progress : function( property, duration, value ) {
    console.log( 'progress', property, duration, value );
  },
  complete : function( property ) {
    console.log( 'ended', property );
  }
}, function( evt ) {
  console.log('Event callback function:', evt);
});

Do something to initialize the transition:

setTimeout(function() {
  $('.box').addClass( 'active' );
}, 1500);

License

This plugin is licensed under the MIT license. A copy of the license is included in this package.