-
-
Notifications
You must be signed in to change notification settings - Fork 983
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
PageInfo method to get parent position #262
Conversation
Hey that looks great. Would love it if you could add some Jasmine tests and docs. My one comment is that after it has been triggered, should the parent page start listening for scroll events and update the callback in the iFrame. |
Ok, I added some docs but I have no idea how to test this since it's a two way call. The iframe pings the parent who sends back information. I looked at different tests you made but could not find any that would be a good baseline. If you have any idea on how this could be done or an example you could point me to, let me know. As for listening to scroll events, my concern is that many different events can change the page infos. Scroll is one, resizing the browser is another, resizing the iframe, moving the iframe, etc. I'm afraid it could get messy trying to catch all the scenarios that would trigger an update and that's why calling the method when needed seems more appropriate in my opinion. |
Thanks for this, I've fixed the jsHint errors and added morked tests for both scripts. Will release in next version. |
Great, thanks! |
Just updated this on the dev branch, so that the callback gets recalled on parent scroll and resize events. |
Here is my pull request for issue #260.
It mimics the Facebook canvas methods. Let me know if it looks about right. You call the
getPageInfo
from the content window with a callback. The message is sent to the parent which makes the calculations and send a message back to the content window. Then the callback is invoked.I didn't write any tests or documentation yet but I will if you wish to merge it to your repo.