tilt.js

A tiny 60+fps parallax tilt hover effect for jQuery.

Github stars Tracking Chart

Build Status

Tilt.js

A tiny requestAnimationFrame powered 60+fps lightweight parallax tilt effect for jQuery.

Weights just ⚖1.71kb Gzipped
Tilt.js demo gif

Take a look at the landing page for demos.

Tilt.js in the wild

Usage

<!DOCTYPE html>
<body>
    <div data-tilt></div> <!-- Tilt element -->
    <script src="jquery.js" ></script> <!-- Load jQuery first -->
    <script src="tilt.js"></script> <!-- Load Tilt.js library -->
</body>

Options

maxTilt:        20,
perspective:    1000,   // Transform perspective, the lower the more extreme the tilt gets.
easing:         "cubic-bezier(.03,.98,.52,.99)",    // Easing on enter/exit.
scale:          1,      // 2 = 200%, 1.5 = 150%, etc..
speed:          300,    // Speed of the enter/exit transition.
transition:     true,   // Set a transition on enter/exit.
disableAxis:    null,   // What axis should be disabled. Can be X or Y.
reset:          true,   // If the tilt effect has to be reset on exit.
glare:          false,  // Enables glare effect
maxGlare:       1       // From 0 - 1.

Events

const tilt = $('.js-tilt').tilt();
tilt.on('change', callback);  // parameters: event, transforms
tilt.on('tilt.mouseLeave', callback); // parameters: event
tilt.on('tilt.mouseEnter', callback); // parameters: event

Methods

const tilt = $('.js-tilt').tilt();

// Destroy instance
tilt.tilt.destroy.call(tilt);

// Get values of instance
tilt.tilt.getValues.call(tilt); // returns [{},{},etc..]

// Reset instance
tilt.tilt.reset.call(tilt);

Install

  • yarn: yarn add tilt.js
  • npm: npm install --save tilt.js

CDN

Alternatives

Main metrics

Overview
Name With Ownergijsroge/tilt.js
Primary LanguageJavaScript
Program languageHTML (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2017-01-13 20:48:59
Pushed At2022-09-14 18:19:30
Last Commit At2022-09-14 20:19:30
Release Count3
Last Release Name1.1.19 (Posted on )
First Release Name1.1.9 (Posted on )
用户参与
Stargazers Count3.9k
Watchers Count71
Fork Count859
Commits Count109
Has Issues Enabled
Issues Count57
Issue Open Count32
Pull Requests Count3
Pull Requests Open Count16
Pull Requests Close Count6
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private