jackmoore/colorbox

iframe focus

clomaka opened this issue · 2 comments

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)

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.

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.