Update to 1.7.2

This commit is contained in:
micku7zu 2021-09-04 10:25:03 +03:00
parent 20f9edad9e
commit ebcf46cec4
7 changed files with 37 additions and 28 deletions

View file

@ -11,7 +11,7 @@ var classCallCheck = function (instance, Constructor) {
* Created by Sergiu Șandor (micku7zu) on 1/27/2017.
* Original idea: https://github.com/gijsroge/tilt.js
* MIT License.
* Version 1.7.1
* Version 1.7.2
*/
var VanillaTilt = function () {
@ -370,19 +370,21 @@ var VanillaTilt = function () {
"left": "50%",
"pointer-events": "none",
"background-image": "linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%)",
"width": this.element.offsetWidth * 2 + "px",
"height": this.element.offsetWidth * 2 + "px",
"transform": "rotate(180deg) translate(-50%, -50%)",
"transform-origin": "0% 0%",
"opacity": "0"
});
this.updateGlareSize();
};
VanillaTilt.prototype.updateGlareSize = function updateGlareSize() {
if (this.glare) {
var glareSize = (this.element.offsetWidth > this.element.offsetHeight ? this.element.offsetWidth : this.element.offsetHeight) * 2;
Object.assign(this.glareElement.style, {
"width": "" + this.element.offsetWidth * 2,
"height": "" + this.element.offsetWidth * 2
"width": glareSize + "px",
"height": glareSize + "px"
});
}
};

File diff suppressed because one or more lines are too long

13
dist/vanilla-tilt.js vendored
View file

@ -5,7 +5,7 @@ var VanillaTilt = (function () {
* Created by Sergiu Șandor (micku7zu) on 1/27/2017.
* Original idea: https://github.com/gijsroge/tilt.js
* MIT License.
* Version 1.7.1
* Version 1.7.2
*/
class VanillaTilt {
@ -55,6 +55,7 @@ class VanillaTilt {
}
this.addEventListeners();
this.reset();
this.updateInitialPosition();
}
@ -358,19 +359,21 @@ class VanillaTilt {
"left": "50%",
"pointer-events": "none",
"background-image": `linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%)`,
"width": `${this.element.offsetWidth * 2}px`,
"height": `${this.element.offsetWidth * 2}px`,
"transform": "rotate(180deg) translate(-50%, -50%)",
"transform-origin": "0% 0%",
"opacity": "0",
});
this.updateGlareSize();
}
updateGlareSize() {
if (this.glare) {
const glareSize = (this.element.offsetWidth > this.element.offsetHeight ? this.element.offsetWidth : this.element.offsetHeight) * 2;
Object.assign(this.glareElement.style, {
"width": `${this.element.offsetWidth * 2}`,
"height": `${this.element.offsetWidth * 2}`,
"width": `${glareSize}px`,
"height": `${glareSize}px`,
});
}
}

File diff suppressed because one or more lines are too long

View file

@ -2,7 +2,7 @@
* Created by Sergiu Șandor (micku7zu) on 1/27/2017.
* Original idea: https://github.com/gijsroge/tilt.js
* MIT License.
* Version 1.7.1
* Version 1.7.2
*/
class VanillaTilt {
@ -356,19 +356,21 @@ class VanillaTilt {
"left": "50%",
"pointer-events": "none",
"background-image": `linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%)`,
"width": `${this.element.offsetWidth * 2}px`,
"height": `${this.element.offsetWidth * 2}px`,
"transform": "rotate(180deg) translate(-50%, -50%)",
"transform-origin": "0% 0%",
"opacity": "0",
});
this.updateGlareSize();
}
updateGlareSize() {
if (this.glare) {
const glareSize = (this.element.offsetWidth > this.element.offsetHeight ? this.element.offsetWidth : this.element.offsetHeight) * 2;
Object.assign(this.glareElement.style, {
"width": `${this.element.offsetWidth * 2}`,
"height": `${this.element.offsetWidth * 2}`,
"width": `${glareSize}px`,
"height": `${glareSize}px`,
});
}
}

View file

@ -10,7 +10,7 @@ var classCallCheck = function (instance, Constructor) {
* Created by Sergiu Șandor (micku7zu) on 1/27/2017.
* Original idea: https://github.com/gijsroge/tilt.js
* MIT License.
* Version 1.7.1
* Version 1.7.2
*/
var VanillaTilt = function () {
@ -369,19 +369,21 @@ var VanillaTilt = function () {
"left": "50%",
"pointer-events": "none",
"background-image": "linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%)",
"width": this.element.offsetWidth * 2 + "px",
"height": this.element.offsetWidth * 2 + "px",
"transform": "rotate(180deg) translate(-50%, -50%)",
"transform-origin": "0% 0%",
"opacity": "0"
});
this.updateGlareSize();
};
VanillaTilt.prototype.updateGlareSize = function updateGlareSize() {
if (this.glare) {
var glareSize = (this.element.offsetWidth > this.element.offsetHeight ? this.element.offsetWidth : this.element.offsetHeight) * 2;
Object.assign(this.glareElement.style, {
"width": "" + this.element.offsetWidth * 2,
"height": "" + this.element.offsetWidth * 2
"width": glareSize + "px",
"height": glareSize + "px"
});
}
};

View file

@ -2,7 +2,7 @@
* Created by Sergiu Șandor (micku7zu) on 1/27/2017.
* Original idea: https://github.com/gijsroge/tilt.js
* MIT License.
* Version 1.7.1
* Version 1.7.2
*/
export default class VanillaTilt {
@ -350,27 +350,27 @@ export default class VanillaTilt {
"pointer-events": "none"
});
const glareSize = (this.element.offsetWidth > this.element.offsetHeight ? this.element.offsetWidth : this.element.offsetHeight) * 2;
Object.assign(this.glareElement.style, {
"position": "absolute",
"top": "50%",
"left": "50%",
"pointer-events": "none",
"background-image": `linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%)`,
"width": `${glareSize}px`,
"height": `${glareSize}px`,
"transform": "rotate(180deg) translate(-50%, -50%)",
"transform-origin": "0% 0%",
"opacity": "0",
});
this.updateGlareSize();
}
updateGlareSize() {
if (this.glare) {
const glareSize = (this.element.offsetWidth > this.element.offsetHeight ? this.element.offsetWidth : this.element.offsetHeight) * 2;
Object.assign(this.glareElement.style, {
"width": `${glareSize}`,
"height": `${glareSize}`,
"width": `${glareSize}px`,
"height": `${glareSize}px`,
});
}
}