Skip to content

A jQuery plugin to add a class and wait for a transition to complete

License

Notifications You must be signed in to change notification settings

adwilk/addClassAndWait

Repository files navigation

Add Class And Wait

A jQuery plugin to add a class and wait for a transition to complete. If you select multiple elements with differing transition durations, the plug in will wait until all have finished.

View Demo

Usage:

$('button').click(function(){

	//Select something and call the function, the parameter
	//is the class/classes that you want to add.

	$('h1').addClassAndWait('myClass')
		.done(function(collection){

			//Triggered once the CSS transition is completed.
			//The parameter of the done function contains the
			//original collection, in this case $('h1').

			collection
				.text('Finished')
		});
});

About

A jQuery plugin to add a class and wait for a transition to complete

Resources

License

Stars

Watchers

Forks

Packages

No packages published