🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

A jQuery plugin to add CSS classes based on direction of mouse entrance or exit of an element.

CSS Plugins

Documentation

jQuery Hover Direction

A simple plugin to add CSS classes based on direction of element entrance or exit. Example

Usage

$(function () { 	$('selector').hoverDirection({ 		cssPrefix : 'hover' 	}); }); 

The following CSS classes will be available for styling:

.<cssPrefix>-enter-top    {} .<cssPrefix>-leave-top    {} .<cssPrefix>-enter-right  {} .<cssPrefix>-leave-right  {} .<cssPrefix>-enter-bottom {} .<cssPrefix>-leave-bottom {} .<cssPrefix>-enter-left   {} .<cssPrefix>-leave-left   {} 

Options

{ 	cssPrefix: 'string' // Prefix directional classes. Defaults to 'hover' } 

Methods

removeClass

Removes all directional classes from selector.

$(function () { 	$('selector').hoverDirection('removeClass'); }); 

This comes in handy for removing classes after the completion of @key-frame animations:

$(function () { 	$('selector').on('webkitAnimationEnd mozAnimationEnd animationEnd', function () {         $(this).filter('[class*="-leave-"]').hoverDirection('removeClass');     }); }); 

destroy

Unbinds all plugin methods from selector.

$(function () { 	$('selector').hoverDirection('destroy'); }); 

You May Also Like