Skip to content

ryanturnerwebdev/DirectionAwareHoverEffect

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DirectionAwareHoverEffect

Direction-aware hover effect using CSS3 transforms and dependency-free JavaScript. The idea is to slide in an overlay from the direction we are moving with the mouse.

article on Codrops

demo

How to use

document.addEventListener('DOMContentLoaded', function() {
    var elements = document.querySelectorAll('.selector');
    
    hoverDir(elements);
    
    // or with custom options
    hoverDir(elements, {
        speed: 500,
        hoverElem: '.custom-class'
    });

});

Default options

defaults: {
    speed: 300, // time in ms
    easing: 'ease',
    hoverElem: 'div'
}

Todo

  • Write tests
  • Add methods
  • Write proper documentation

Licensed under the MIT License

About

Vanilla JS version of codrops DirectionAwareHoverEffect plugin. The idea is to slide in an overlay from the direction we are moving with the mouse.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 42.6%
  • HTML 30.2%
  • CSS 27.2%