plax icon indicating copy to clipboard operation
plax copied to clipboard

Effect stop working when mouseover an iframe

Open AgustinVignoli opened this issue 12 years ago • 3 comments

Hello, First of all, thank´s so much for this awesome plugin. I have a web with some iframes, and when the cursor goes over the oframe area, the plax effect on the layers behind stop working, I´have tried something like this $.plax.enable({ "activityTarget": $('#viewport, .frames')}) to target also the container of the layer to be "plaxed" and the ifrmaes, but it doesn´t worked, altough y tried $.plax.enable({ "activityTarget": $('.frames')}) just to see if it´ll work at least on the iframes, but it didn´t. Is there a way to achieve that?? Thanks

AgustinVignoli avatar Jan 29 '13 20:01 AgustinVignoli

Hi @AgustinVignoli,

My guess is that since an iframe is considered an entirely different website, it has its own set of mousemove events. Essentially, when you move the mouse over the iframe, the context of capturing mouse events switches to the web page within the iframe, which — for security reasons — has no concept of connection to the outside page. It's possible you could prove me wrong, but as far as I know, it's impossible to avoid. If you don't actually need to interact with the content of the iframe, you could presumably put an empty div over the top of it to effectively "hide" the iframe from window. The browser would again be able to catch mousemove events in that area, but obviously, you won't be able to interact with the content of the iframe.

cameronmcefee avatar Jan 29 '13 21:01 cameronmcefee

Thanks for you reply! I was thinking that may would work if I call the function from the

tag of the iframe web too, I mean, call it as a parent function, to keep executing the plugin, I´m going to try that and´ll let you know. pd: sorry for my bad english, I speak spanish so I´m trying to comunicate as well as I can ;)

AgustinVignoli avatar Jan 30 '13 11:01 AgustinVignoli

That may actually work if you modify plax a little. Looks like you can reference the parent of an iframe: http://stackoverflow.com/questions/5477324/iframe-calling-parent-javascript

The only hurdle I see is that while you could potentially capture mouse position, it will be within the context of the iframe, not the main window. You'd have to work out some kind of math to convert that number to correspond to it's location in the main window.

cameronmcefee avatar Jan 30 '13 15:01 cameronmcefee