WordPress.org

Ready to get started?Download WordPress

Forums

Easy FancyBox
[resolved] Launch mailto close fancybox in iFrame? (5 posts)

  1. robgnyc
    Member
    Posted 2 years ago #

    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.

    http://wordpress.org/extend/plugins/easy-fancybox/

  2. RavanH
    Member
    Plugin Author

    Posted 2 years ago #

    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:your@mail.addr&subject=agreement">I Agree</a>

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

  3. robgnyc
    Member
    Posted 2 years ago #

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

    The site is at:

    http://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:blog@ogletreedeakins.com?subject=Comments for Ogletree Deakins Blog">

    Any help would be much appreciated.

  4. RavanH
    Member
    Plugin Author

    Posted 2 years ago #

    Sorry, that should be

    parent.jQuery.fancybox.close();

    since WordPress runs jQuery in noConflict mode...

  5. robgnyc
    Member
    Posted 2 years ago #

    Thanks that worked. Great support. Great plugin.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.