I'm using PHP & nyromodal to open a modal containing a series of images (called from the database). When one of these thumbnails is clicked, I want another modal to open (containing the larger image) on top of the already open modal. Instead, all it does is resize the already open modal and put the image in there. What I want is a new modal, so that when the user closes the new modal the old modal is still open underneath it...
Code:
One the main page:
<script type="text/javascript">
$().ready(function() {
$('a.projectmodaltrigger').nm();
$(开发者_StackOverflow社区'a.projectcontentimgtrigger').nm();
});
</script>
<a href="project.php?id=1" class="projectmodaltrigger">
<img src="uploads/projects/1/test1.jpg" border="0" />
</a>
On the page that's opened in the modal (project.php):
<a href="uploads/projectcontent/1/image.jpg" class="projectcontentimgtrigger">
<img src="uploads/projectcontent/1/thumb/image.jpg" border="0" />
</a>
Is this possible? Sensible? Can anyone help?
Thanks, HR
I think you have to add target="_blank" in the first link:
<a href="project.php?id=1" class="projectmodaltrigger" target="_blank">
<img src="uploads/projects/1/test1.jpg" border="0" />
</a>
So nyroModal will open the target php page in an iframe and this should allow the nested modal as you need. Let me know how it will go.
Since I have solved this issue for myself, I can tell you what I did.
It is not enough to give the second modal the same class "projectcontentimgtrigger", you have to explicitely ask nyroModal to stack the subsequent links in modals like this :
$('a.projectmodaltrigger').nm({'stack' : true});
Last thing : if the second level modal must himself stack in a modal, you have to include the same call somewhere in your new page (e.g project.php for you). This could be solved with jquery.live() maybe (I did not try though). So again in "project.php":
$('a.projectmodaltrigger').nm({'stack' : true});
Hope this helps !
精彩评论