问题
I have an iframe in which are some photo links. I'm trying to enable the lightbox to go the parent to display the photos but at the moment it is confined to within the iframe itself.
I tried using <base target="_parent"
which works for navigating links doesn't seem to work for lightbox.
The lightbox I am using is jQuery based. NyroModal v2 :: jQuery Plugin.
I have searched google and found one apparent solution on windows-addict.com but it doesn't work. I even switched the the exact same lightbox he was using in his example in case it was a mistake on my end.
I'm pretty sure there is a simple explaination for someone who knows about lightbox and iframes but I've exhausted all of my ideas at this point!
Does anyone know a solution?
EDIT with code:
This is the call in the <head>
:
<!-- lightbox -->
<link rel="stylesheet" href="http://static.tumblr.com/wlao44f/cDln5ocfk/nyromodal.css" type="text/css" media="screen" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://static.tumblr.com/wlao44f/kYon5ocgm/jquery.nyromodal.custom.js"></script>
<!--[if IE 6]>
<script type="text/javascript" src="http://static.tumblr.com/wlao44f/Qp8n5ochk/jquery.nyromodal-ie6.min.js"></script>
<![endif]-->
<script type="text/javascript">
$(function() {
$('.nyroModal').nyroModal();
});
</script>
<!-- lightbox -->
This is in the <body>
:
<a href="http://www.utsc.utoronto.ca/~parentinfant/assets/img/sample-thumbnail275.jpg" id="imgFiche" class="nyroModal" rel="gal">Img 1</a>
<a href="http://www.utsc.utoronto.ca/~parentinfant/assets/img/sample-thumbnail275.jpg" class="nyroModal" rel="gal">Img 2</a>
<a href="http://www.utsc.utoronto.ca/~parentinfant/assets/img/sample-thumbnail275.jpg" class="nyroModal" rel="gal">Img 3</a>
<script type="text/javascript">
$(function() {
$('.nyroModal').nyroModal();
});
</script>
Both of the <head>
and <body>
segments of code are located within the iframe content.
The call to the iframe is simply:
<iframe src="mysite.com/iframe" style="border-style: none; width: 100%; height: 1500px; overflow-y: hidden;"></iframe>
来源:https://stackoverflow.com/questions/23700172/open-lightbox-link-outside-of-iframe-window