in the iframe box,i want to close the popping box....

1,623 views
Skip to first unread message

wis...@gmail.com

unread,
May 20, 2009, 3:34:20 AM5/20/09
to fancybox
hello?

in the iframe box,i want to close the popping box,i use the code like
"$(window.parent.document).find("#id_iframe").fancybox.close();" but
it can't run!

what should i do? please help me~~~

JFK

unread,
May 21, 2009, 4:16:08 AM5/21/09
to fancybox
add your closing script within your (iframe) file:
<a href="#" onClick="$.fn.fancybox.close();" title="Close window"
>close fancybox</a>

don't forget to set 'hideOnContentClick' to false in your calling
script

ff w

unread,
May 21, 2009, 5:16:43 AM5/21/09
to fanc...@googlegroups.com
thanks,i see,and i will do that later.

Bertrand

unread,
Jun 28, 2009, 6:34:10 PM6/28/09
to fancybox
Hi

I want ti try the same thing (closing the fancybox from the inner
iframe)

On 21 mai, 10:16, JFK <jfk.d...@gmail.com> wrote:
> add your closing script within your (iframe) file:
> <a href="#" onClick="$.fn.fancybox.close();" title="Close window"
>
> >close fancybox</a>

Il tried this and also $("*",top.document).fn.fancybox.close(); and it
don't work:

Error : $.fn.fancybox is undefined

I'm stuck... :-(

--
Beurt

Bertrand

unread,
Jun 28, 2009, 6:39:43 PM6/28/09
to fancybox
On 29 juin, 00:34, Bertrand <bma...@gmail.com> wrote:
> Il tried this and also $("*",top.document).fn.fancybox.close(); and it
> don't work:
>
> Error : $.fn.fancybox is undefined
>
> I'm stuck... :-(
>

Not so stuck finally ! I got my answer from:
http://stackoverflow.com/questions/512257/jquery-modal-boxes-and-iframe/787569#787569

parent.$.fn.fancybox.close worked for me !

--
Beurt

ff w

unread,
Jun 28, 2009, 8:28:48 PM6/28/09
to fanc...@googlegroups.com
haha,it works!thanks very much!

Sebastian Naicker

unread,
Jan 20, 2015, 3:23:35 AM1/20/15
to fanc...@googlegroups.com
I found this helps the most, and after searching around everywhere and found nothing like this, thought I'd share it.
Just add this line to your anchor tag so it resembles <a href="javascript:parent.$.fancybox.close();" class="close" >Close</a>
Reply all
Reply to author
Forward
0 new messages