Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2003
    Location
    England
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.
    One Man Army

  • #2
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    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.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • #3
    New to the CF scene
    Join Date
    Jan 2003
    Location
    England
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    One Man Army

  • #4
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    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.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • #5
    New to the CF scene
    Join Date
    Jan 2003
    Location
    England
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The answer turns out to be
    Code:
    parent.$.fn.fancybox.close();
    This correctly closes the modal window
    One Man Army


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •