Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effect stop working when mouseover an iframe #37

Open
AgustinVignoli opened this issue Jan 29, 2013 · 3 comments
Open

Effect stop working when mouseover an iframe #37

AgustinVignoli opened this issue Jan 29, 2013 · 3 comments

Comments

@AgustinVignoli
Copy link

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

@cameronmcefee
Copy link
Owner

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.

@AgustinVignoli
Copy link
Author

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 ;)

@cameronmcefee
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants