CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript frameworks (http://www.codingforums.com/forumdisplay.php?f=62)
-   -   jQuery Fancy Box Autoclose... (http://www.codingforums.com/showthread.php?t=167858)

Hydrogen 06-02-2009 10:31 AM

Fancy Box Autoclose...
 
Hi there, taking a bit of a shot in the dark here but does anyone use Fancy Box? - http://fancy.klade.lv/home

I have a requirement to auto close a Fancy Box instance, there is some code that you're supposed to be able to use for an onclick event -
Code:

$.fn.fancybox.close()
I basically need to execute this but not as an onclick, it needs to trigger automatically at the desired point.

Bit of a long shot I know but if anyone has any experience of this would appreciate any input.

Cheers.

Eldarrion 06-02-2009 03:26 PM

Have you tried calling the function whenever? Sounds like a fairly easy thing to do. It says on the website that you need to call it onClick, but I doubt it is limited to clicks only.

Hydrogen 06-02-2009 03:31 PM

I've tried
Code:

$(this).html('Question sent successfully, thank you.').addClass('messageboxok').fadeTo(900,1,
function()
  {
          // close
          $.fn.fancybox.close();
  });

Nothing happens - I guess it's not as simple as this, but I seems like something you should be able to do.

Eldarrion 06-02-2009 05:40 PM

Might be easier to just debug what you have? Is it live somewhere to see if it throws any errors? The function works fine when called pretty much anywhere... haven't tested it in certain scenarios, but eh... didn't think they would be required anyway.

Hydrogen 06-03-2009 10:01 AM

The answer turns out to be
Code:

parent.$.fn.fancybox.close();
This correctly closes the modal window :thumbsup:


All times are GMT +1. The time now is 06:57 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.