tilt.js icon indicating copy to clipboard operation
tilt.js copied to clipboard

Hovers over Iframes are broken

Open Levelleor opened this issue 8 years ago • 5 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 :)

Levelleor avatar Apr 24 '17 15:04 Levelleor

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

gijsroge avatar Apr 26 '17 15:04 gijsroge

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

Levelleor avatar Apr 26 '17 15:04 Levelleor

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 https://github.com/gijsroge/tilt.js/blob/a92d1bda917e1ba0d0981a6d5cf539917e3cc13b/src/tilt.jquery.js#L119

thanks J

jmp909 avatar Sep 09 '17 15:09 jmp909

@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

jmp909 avatar Sep 10 '17 11:09 jmp909

Thank you so much you saved my life!!!

Dimitri-Jacquin avatar Mar 07 '20 15:03 Dimitri-Jacquin