GitPedia

Universal tilt.js

πŸŽ† Parallax tilt effect library

From universal-tilt-jsΒ·Updated June 14, 2026Β·View on GitHubΒ·

**universal tilt.js** is a πŸŽ† Parallax tilt effect library The project is written primarily in JavaScript, distributed under the MIT License license, first published in 2018. Key topics include: gyroscope, javascript, jquery, movement, parallax.

Latest release: v2.0.6β€” 2.0.6

universal-tilt.js

NPM version
NPM downloads

About

JavaScript & jQuery elements movement library based on:

Tilt.js by Gijs Rogé and vanilla-tilt.js by Șandor Sergiu

universal-tilt.js contains additional functions for mobile devices with gyroscope, new Position Base option and more!

Demo

See plugin in action

React plugin

If you use React, install component with the implementation of the universal-tilt.js library!
More here

How to Install

First, install the library in your project by npm:

bash
$ npm install universal-tilt.js

Or Yarn:

bash
$ yarn add universal-tilt.js

You can also connect script via one of CDNs:<br>
bundle.run: https://bundle.run/universal-tilt.js<br>
jsDelivr: https://cdn.jsdelivr.net/npm/universal-tilt.js/<br>
unpkg: https://unpkg.com/universal-tilt.js/

Getting Started

Connect libary with project using script tag in HTML:

html
<script src="/path/to/universal-tilt.js"></script>

ES6 import:

js
import UniversalTilt from 'universal-tilt.js';

Or CommonJS:

js
const UniversalTilt = require('universal-tilt.js');

Next use library with:

β€’ Vanilla JavaScript e.g:

js
const elems = document.querySelectorAll('.tilt'); const tilt = UniversalTilt.init({ elements: elems, settings: { // options... }, callbacks: { // callbacks... } });

β€’ or jQuery e.g:

Connect jQuery in HTML

html
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>

Or include via command line and CommonJS

sh
$ npm install jquery $ yarn add jquery $ bower install jquery
js
const jQuery = require('jquery');

And call plugin on element

js
$('.tilt').universalTilt({ settings: { // options... }, callbacks: { // callbacks... } });

β€’ Plugin supports autoinit

To use it, add data-tilt to html element e.g:

html
<div data-tilt></div>

Methods

β€’ Destroy method

js
elems.universalTilt.destroy();

β€’ Get values method

js
elems.universalTilt.getValues();

β€’ Reset method

js
elems.universalTilt.reset();

Options

Settings

NameTypeDefaultDescriptionAvailable options
basestringelementThe surface from which the location of the mouse is capturedelement or window
disabledstringnullDisable axisx or y
easingstringcubic-bezier(.03, .98, .52, .99)Transition easingcubic-bezier/ease/linear/etc.
excludeRegExpnullDisable tilt effect on selected user agentse.g: <code>/(Firefox|iPad)/</code>
maxnumber35Max tilt valuee.g: 28
perspectivenumber1000Tilt effect perspectivee.g: 700
resetbooleantrueEnable/disable element position reset after mouseouttrue (enable), false (disable)
reversebooleanfalseReverse tilt effect directorytrue (reverse directory), false (standard directory)
scalenumber1.0Element scale on mouseover0.9/1.3/etc.
shinebooleanfalseAdd/remove shine effect on mouseovertrue (add), false (remove)
shine-opacity<sup>1</sup>number0Add/remove shine effect on mouseovervalues >= 0 and <= 1
shine-save<sup>1</sup>booleanfalseSave/reset shine effect on mouseouttrue (save), false (reset)
speednumber300Transition speed (ms)e.g: 500

Callbacks

NameDescriptionAvailable options
onDestroyCallback on plugin destroyel => { /* code */ }
onDeviceMove<sup>2</sup>Callback on device moveel => { /* code */ }
onInitCallback on plugin initel => { /* code */ }
onMouseEnterCallback on mouse enterel => { /* code */ }
onMouseLeaveCallback on mouse leaveel => { /* code */ }
onMouseMoveCallback on mouse moveel => { /* code */ }

<sup>1</sup> shine value must be true<br>
<sup>2</sup> only for devices supported device motion

Event

tiltChange event will output the x, y & angle of tilting

License

This project is licensed under the MIT License Β© 2018-present Jakub Biesiada

Contributors

Showing top 2 contributors by commit count.

View all contributors on GitHub β†’

This article is auto-generated from universal-tilt-js/universal-tilt.js via the GitHub API.Last fetched: 6/23/2026