gijsroge / tilt.js

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

Home Page:http://gijsroge.github.io/tilt.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hovers over Iframes are broken

Levelleor opened this issue · comments

When I hover over Iframe trying to use this plugin there is an error:

Uncaught TypeError: Cannot read property 'x' of undefined
    at HTMLDivElement.getValues (tilt.jquery.js:91)
    at HTMLDivElement.updateTransforms (tilt.jquery.js:106)
getValues @ tilt.jquery.js:91
updateTransforms @ tilt.jquery.js:106

It works perfectly with everything else, but not with one thing I need. I wanted to apply this effect to google maps iframe.

I guess this is kind of issue so here I am :)

Hey, thanks for reporting. Can you provide a codepen example so i can see the issue?

@gijsroge Here is an example: https://jsfiddle.net/orpavLep/
If you hover over iframe it doesn't work, but it works on everything else.

I don't think it's just iframes, I also get it but i'm not sure on what currently

the error appears to be in

const percentageX = (this.mousePositions.x - left) / width;

thanks
J

@gijsroge

I temporarily added this line to the top of getValues

if(!this.mousePositions) this.mousePositions = getMousePositions.call(this);

that theoretically would get rid of the error cannot read property 'x' of undefined

however it suggests something is getting called in the wrong order or not being instantiated in time

thanks
j

Thank you so much you saved my life!!!