mirror of
https://github.com/micku7zu/vanilla-tilt.js
synced 2024-06-10 17:52:14 +02:00
Fix gyroscope false and update to 1.6.1
This commit is contained in:
parent
c5fab87641
commit
b0cc942f99
13
dist/vanilla-tilt.babel.js
vendored
13
dist/vanilla-tilt.babel.js
vendored
|
@ -11,7 +11,7 @@ var classCallCheck = function (instance, Constructor) {
|
|||
* Created by Șandor Sergiu (micku7zu) on 1/27/2017.
|
||||
* Original idea: https://github.com/gijsroge/tilt.js
|
||||
* MIT License.
|
||||
* Version 1.6.0
|
||||
* Version 1.6.1
|
||||
*/
|
||||
|
||||
var VanillaTilt = function () {
|
||||
|
@ -41,6 +41,7 @@ var VanillaTilt = function () {
|
|||
|
||||
this.glare = this.isSettingTrue(this.settings.glare);
|
||||
this.glarePrerender = this.isSettingTrue(this.settings["glare-prerender"]);
|
||||
this.gyroscope = this.isSettingTrue(this.settings.gyroscope);
|
||||
|
||||
if (this.glare) {
|
||||
this.prepareGlare();
|
||||
|
@ -93,11 +94,14 @@ var VanillaTilt = function () {
|
|||
this.elementListener.addEventListener("mouseenter", this.onMouseEnterBind);
|
||||
this.elementListener.addEventListener("mousemove", this.onMouseMoveBind);
|
||||
this.elementListener.addEventListener("mouseleave", this.onMouseLeaveBind);
|
||||
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
|
||||
if (this.glare) {
|
||||
window.addEventListener("resize", this.onWindowResizeBind);
|
||||
}
|
||||
|
||||
if (this.gyroscope) {
|
||||
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -109,7 +113,10 @@ var VanillaTilt = function () {
|
|||
this.elementListener.removeEventListener("mouseenter", this.onMouseEnterBind);
|
||||
this.elementListener.removeEventListener("mousemove", this.onMouseMoveBind);
|
||||
this.elementListener.removeEventListener("mouseleave", this.onMouseLeaveBind);
|
||||
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
|
||||
if (this.gyroscope) {
|
||||
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
}
|
||||
|
||||
if (this.glare) {
|
||||
window.removeEventListener("resize", this.onWindowResizeBind);
|
||||
|
|
2
dist/vanilla-tilt.babel.min.js
vendored
2
dist/vanilla-tilt.babel.min.js
vendored
File diff suppressed because one or more lines are too long
13
dist/vanilla-tilt.js
vendored
13
dist/vanilla-tilt.js
vendored
|
@ -5,7 +5,7 @@ var VanillaTilt = (function () {
|
|||
* Created by Șandor Sergiu (micku7zu) on 1/27/2017.
|
||||
* Original idea: https://github.com/gijsroge/tilt.js
|
||||
* MIT License.
|
||||
* Version 1.6.0
|
||||
* Version 1.6.1
|
||||
*/
|
||||
|
||||
class VanillaTilt {
|
||||
|
@ -32,6 +32,7 @@ class VanillaTilt {
|
|||
|
||||
this.glare = this.isSettingTrue(this.settings.glare);
|
||||
this.glarePrerender = this.isSettingTrue(this.settings["glare-prerender"]);
|
||||
this.gyroscope = this.isSettingTrue(this.settings.gyroscope);
|
||||
|
||||
if (this.glare) {
|
||||
this.prepareGlare();
|
||||
|
@ -80,11 +81,14 @@ class VanillaTilt {
|
|||
this.elementListener.addEventListener("mouseenter", this.onMouseEnterBind);
|
||||
this.elementListener.addEventListener("mousemove", this.onMouseMoveBind);
|
||||
this.elementListener.addEventListener("mouseleave", this.onMouseLeaveBind);
|
||||
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
|
||||
if (this.glare) {
|
||||
window.addEventListener("resize", this.onWindowResizeBind);
|
||||
}
|
||||
|
||||
if (this.gyroscope) {
|
||||
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,7 +98,10 @@ class VanillaTilt {
|
|||
this.elementListener.removeEventListener("mouseenter", this.onMouseEnterBind);
|
||||
this.elementListener.removeEventListener("mousemove", this.onMouseMoveBind);
|
||||
this.elementListener.removeEventListener("mouseleave", this.onMouseLeaveBind);
|
||||
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
|
||||
if(this.gyroscope) {
|
||||
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
}
|
||||
|
||||
if (this.glare) {
|
||||
window.removeEventListener("resize", this.onWindowResizeBind);
|
||||
|
|
2
dist/vanilla-tilt.min.js
vendored
2
dist/vanilla-tilt.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -35,6 +35,11 @@ A smooth 3D tilt javascript library forked from [Tilt.js (jQuery version)](https
|
|||
"glare-prerender": false, // false = VanillaTilt creates the glare elements for you, otherwise
|
||||
// you need to add .js-tilt-glare>.js-tilt-glare-inner by yourself
|
||||
"mouse-event-element": null // css-selector or link to HTML-element what will be listen mouse events
|
||||
gyroscope: true // Boolean to enable/disable device orientation detection,
|
||||
gyroscopeMinAngleX: -45 // This is the bottom limit of the device angle on X axis, meaning that a device rotated at this angle would tilt the element as if the mouse was on the left border of the element;
|
||||
gyroscopeMaxAngleX: 45 // This is the top limit of the device angle on X axis, meaning that a device rotated at this angle would tilt the element as if the mouse was on the right border of the element;
|
||||
gyroscopeMinAngleY: -45 // This is the bottom limit of the device angle on Y axis, meaning that a device rotated at this angle would tilt the element as if the mouse was on the top border of the element;
|
||||
gyroscopeMaxAngleY: 45 // This is the top limit of the device angle on Y axis, meaning that a device rotated at this angle would tilt the element as if the mouse was on the bottom border of the element;
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -93,6 +98,12 @@ Original library: [Tilt.js](http://gijsroge.github.io/tilt.js/)
|
|||
|
||||
Original library author: [Gijs Rogé](https://twitter.com/GijsRoge)
|
||||
|
||||
#### Contributors
|
||||
|
||||
- [Livio Brunner](https://github.com/BrunnerLivio) <<a href="mailto:contact@brunnerliv.io">contact@brunnerliv.io</a>> (Typings & Glare Effect)
|
||||
- [Oleg Postoev](https://github.com/Dok11)
|
||||
- [Matteo Rigon](https://github.com/matteo-rigon) (Device orientation support)
|
||||
|
||||
### License
|
||||
|
||||
MIT License
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Created by Șandor Sergiu (micku7zu) on 1/27/2017.
|
||||
* Original idea: https://github.com/gijsroge/tilt.js
|
||||
* MIT License.
|
||||
* Version 1.6.0
|
||||
* Version 1.6.1
|
||||
*/
|
||||
|
||||
class VanillaTilt {
|
||||
|
@ -29,6 +29,7 @@ class VanillaTilt {
|
|||
|
||||
this.glare = this.isSettingTrue(this.settings.glare);
|
||||
this.glarePrerender = this.isSettingTrue(this.settings["glare-prerender"]);
|
||||
this.gyroscope = this.isSettingTrue(this.settings.gyroscope);
|
||||
|
||||
if (this.glare) {
|
||||
this.prepareGlare();
|
||||
|
@ -77,11 +78,14 @@ class VanillaTilt {
|
|||
this.elementListener.addEventListener("mouseenter", this.onMouseEnterBind);
|
||||
this.elementListener.addEventListener("mousemove", this.onMouseMoveBind);
|
||||
this.elementListener.addEventListener("mouseleave", this.onMouseLeaveBind);
|
||||
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
|
||||
if (this.glare) {
|
||||
window.addEventListener("resize", this.onWindowResizeBind);
|
||||
}
|
||||
|
||||
if (this.gyroscope) {
|
||||
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +95,10 @@ class VanillaTilt {
|
|||
this.elementListener.removeEventListener("mouseenter", this.onMouseEnterBind);
|
||||
this.elementListener.removeEventListener("mousemove", this.onMouseMoveBind);
|
||||
this.elementListener.removeEventListener("mouseleave", this.onMouseLeaveBind);
|
||||
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
|
||||
if(this.gyroscope) {
|
||||
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
}
|
||||
|
||||
if (this.glare) {
|
||||
window.removeEventListener("resize", this.onWindowResizeBind);
|
||||
|
|
|
@ -10,7 +10,7 @@ var classCallCheck = function (instance, Constructor) {
|
|||
* Created by Șandor Sergiu (micku7zu) on 1/27/2017.
|
||||
* Original idea: https://github.com/gijsroge/tilt.js
|
||||
* MIT License.
|
||||
* Version 1.6.0
|
||||
* Version 1.6.1
|
||||
*/
|
||||
|
||||
var VanillaTilt = function () {
|
||||
|
@ -40,6 +40,7 @@ var VanillaTilt = function () {
|
|||
|
||||
this.glare = this.isSettingTrue(this.settings.glare);
|
||||
this.glarePrerender = this.isSettingTrue(this.settings["glare-prerender"]);
|
||||
this.gyroscope = this.isSettingTrue(this.settings.gyroscope);
|
||||
|
||||
if (this.glare) {
|
||||
this.prepareGlare();
|
||||
|
@ -92,11 +93,14 @@ var VanillaTilt = function () {
|
|||
this.elementListener.addEventListener("mouseenter", this.onMouseEnterBind);
|
||||
this.elementListener.addEventListener("mousemove", this.onMouseMoveBind);
|
||||
this.elementListener.addEventListener("mouseleave", this.onMouseLeaveBind);
|
||||
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
|
||||
if (this.glare) {
|
||||
window.addEventListener("resize", this.onWindowResizeBind);
|
||||
}
|
||||
|
||||
if (this.gyroscope) {
|
||||
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -108,7 +112,10 @@ var VanillaTilt = function () {
|
|||
this.elementListener.removeEventListener("mouseenter", this.onMouseEnterBind);
|
||||
this.elementListener.removeEventListener("mousemove", this.onMouseMoveBind);
|
||||
this.elementListener.removeEventListener("mouseleave", this.onMouseLeaveBind);
|
||||
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
|
||||
if (this.gyroscope) {
|
||||
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
}
|
||||
|
||||
if (this.glare) {
|
||||
window.removeEventListener("resize", this.onWindowResizeBind);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "vanilla-tilt",
|
||||
"version": "1.6.0",
|
||||
"version": "1.6.1",
|
||||
"description": "A smooth 3D tilt javascript library forked from Tilt.js",
|
||||
"main": "lib/vanilla-tilt.js",
|
||||
"module_es2015": "lib/vanilla-tilt.es2015.js",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Created by Șandor Sergiu (micku7zu) on 1/27/2017.
|
||||
* Original idea: https://github.com/gijsroge/tilt.js
|
||||
* MIT License.
|
||||
* Version 1.6.0
|
||||
* Version 1.6.1
|
||||
*/
|
||||
|
||||
export default class VanillaTilt {
|
||||
|
@ -29,6 +29,7 @@ export default class VanillaTilt {
|
|||
|
||||
this.glare = this.isSettingTrue(this.settings.glare);
|
||||
this.glarePrerender = this.isSettingTrue(this.settings["glare-prerender"]);
|
||||
this.gyroscope = this.isSettingTrue(this.settings.gyroscope);
|
||||
|
||||
if (this.glare) {
|
||||
this.prepareGlare();
|
||||
|
@ -77,11 +78,14 @@ export default class VanillaTilt {
|
|||
this.elementListener.addEventListener("mouseenter", this.onMouseEnterBind);
|
||||
this.elementListener.addEventListener("mousemove", this.onMouseMoveBind);
|
||||
this.elementListener.addEventListener("mouseleave", this.onMouseLeaveBind);
|
||||
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
|
||||
if (this.glare) {
|
||||
window.addEventListener("resize", this.onWindowResizeBind);
|
||||
}
|
||||
|
||||
if (this.gyroscope) {
|
||||
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +95,10 @@ export default class VanillaTilt {
|
|||
this.elementListener.removeEventListener("mouseenter", this.onMouseEnterBind);
|
||||
this.elementListener.removeEventListener("mousemove", this.onMouseMoveBind);
|
||||
this.elementListener.removeEventListener("mouseleave", this.onMouseLeaveBind);
|
||||
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
|
||||
if(this.gyroscope) {
|
||||
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);
|
||||
}
|
||||
|
||||
if (this.glare) {
|
||||
window.removeEventListener("resize", this.onWindowResizeBind);
|
||||
|
|
Loading…
Reference in a new issue