Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
485 views
in Technique[技术] by (71.8m points)

javascript - JQuery Modal Boxes and Iframe

I've been using Simple Modal and i feel it doesn't live up to what i need at the moment.

Is there a Modal Box that supports loading external files and allows those external files to close the modal box and redirect the parent page to some url.

An example of what i want to do. You have a list of users, you could click "Add user" and a Modal Box with the form pops up, you fill that in and submit it. That would close the box and reload the user list page so you would see the user in the list.

Then you could click "Edit user" and a Modal Box with the user info filled in the form fields would pop up and you could edit, submit and it would close and refresh.

I know this can be done if i have the user info form as a hidden div for each user but this will not scale well and it is a lot of overhead data.

I found some code about this on Google Code but just can't get it to work (possibly different simple modal version

I am willing to change to another modal box tool also.

UPDATE:

Do either Thickbox or Fancybox support being closed from a child IFrame element?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Sounds like you already found the answer but for the benefit of others you can close an iFrame implementation of FancyBox by using the following JavaScript in the iFrame:

parent.$.fn.fancybox.close();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...