Skip to content

A script that takes in a Node, NodeList, ClassName or Array of elements and adds a perspective effect on mouse over.

Notifications You must be signed in to change notification settings

DanielTate/Proximity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proximity

proximity.mp4

Your card will become a wrapper. Make sure to add background styles to the .proximity-wrapper class.

Usage:

Proximity({
    elements: '.card',
    perspective: '800px',
    rotateY: (x) => `${x / 4}deg`,
    rotateX: (x) => `${(x / 4) * -1}deg`,
    transform: 'transform 250ms ease-out'
})

Note:

The elements option can be either a Node, NodeList, ClassName or Array of HTMLNodes.

These are all valid options.

const element = document.querySelector('.card')
Proximity({ elements: element })

const elements = document.querySelectorAll('.card')
Proximity({ elements })

const elements = Array.from(document.querySelectorAll('.card'))
Proximity({ elements })

About

A script that takes in a Node, NodeList, ClassName or Array of elements and adds a perspective effect on mouse over.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published