• Resolved robgnyc

    (@robgnyc)


    How would I have a button (simple image wrapped in a href or <button>) both launch a mail to link and then close the fancybox window?

    I’m launching an iframe from the WordPress menu to show a disclaimer and want the user to click “I Agree” then get their email client launched and have the Fancybox close and leave them on same page they came from.

    https://www.ads-software.com/extend/plugins/easy-fancybox/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi, from within an iframe, you can use the script javascript:parent.$.fancybox.close();. Note that the page inside the iframe needs to be on the same domain as the parent page for it to work.

    Example:

    <a onclick="javascript:parent.$.fancybox.close();return true;" href="mailto:[email protected]&subject=agreement">I Agree</a>

    More info on https://fancybox.net/api

    Thread Starter robgnyc

    (@robgnyc)

    I added this but it doesn’t seem to be working.

    The site is at:

    https://ogletree.mediumstudios.com/

    And link that launches the Fancybox comes off of the “Contact” submenu item (Blog Home About Contact) below the main blue menu bar.

    Added code exactly as written but modified for my mailto which is activated by the “I Agree to Terms” button.

    <a onclick="javascript:parent.$.fancybox.close();return true;" href="mailto:[email protected]?subject=Comments for Ogletree Deakins Blog">

    Any help would be much appreciated.

    Sorry, that should be

    parent.jQuery.fancybox.close();

    since WordPress runs jQuery in noConflict mode…

    Thread Starter robgnyc

    (@robgnyc)

    Thanks that worked. Great support. Great plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Easy FancyBox] Launch mailto close fancybox in iFrame?’ is closed to new replies.