This question isn't about popping up an iframe inside a Lightbox; rather, it's about an iframe on a page that can launch its own Lightbox-style box in the page that contains that iframe. I'm thinking this can't be possible, because the iframe contains the contents of the other URL and whatever Lightbox that URL launches has to fit within the iframe. Thanks.
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
- how to get selected text from iframe with javascri
It is possible but only if you can have some controll of the remote server. There are various ways to do that but to gice you a quick start you can use this simple frame postman.
When you recieve a message from the frame (probably with image URL) you simply open a lightbox dialog in your main document.
If both sites belong to the same domain you can add the JS of the lightbox to the main frame and call the function inside the iframe using ´parent.function´
Try looking at fancybox. I know that supports iframes, and I always use it over Lightbox, much more customisable. I am pretty sure it can deal with nested iframes, however I could be wrong. Worth a try nether the less.
There are examples on the bottom of the page: http://fancybox.net/
I don't know if it's around anywhere online, but i saw Facebook give a presentation about injecting an iframe into other sites to circumvent such problems with cross-site issues. Worth a look.
We are facing the same issue, i guess one possible solution is window.open from an iframe.
A simple workaround that worked for me was to initialize lightbox in the parent window, then to create a blank placeholder link, and function that changes the href and clicks the placeholder link:
In the header or footer of the parent window:
Somewhere in the body of the parent window:
So in the iframe I call the parent function to launch the fancybox: