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

iframe focus #884

Open
clomaka opened this issue Nov 26, 2019 · 2 comments
Open

iframe focus #884

clomaka opened this issue Nov 26, 2019 · 2 comments

Comments

@clomaka
Copy link

clomaka commented Nov 26, 2019

I'm adding arrow key navigation to my iframe html, but the code only works after i click somewhere inside the iframe first. Is there some way to force focus on the iframe on load or on complete?

(btw, i have iframe and inline both set to true, just in case that'swrong)

@clomaka
Copy link
Author

clomaka commented Nov 27, 2019

so far, i'm solving it like most other ppl - adding a button at the top:
button id="focalpoint" "x"<"/button">
and adding that id to the called url:
<a class='iframe' id="portfolioframe" href="portfolio_Halo5_01.html#focalpoint"><img class="image" src="img/TH_Halo501.jpg"></a>

I tried adding a div id to the url, but that didn't work for some reason, so i'll stick with a 1px button w. an id.

@jackmoore
Copy link
Owner

My apologies for the late reply. I wasn't sure how to address this, so I'm glad you are finding a way. That sounds like a very good option. I figured you could use the onComplete callback to select the iframe contentWindow and focus, but I believe that has to wait until the iframe's onload event fires, which is not something I would want to wait on if I could avoid it.

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