WordPress.org

Ready to get started?Download WordPress

Forums

Easy FancyBox
[resolved] Issue creating close link for inline content (10 posts)

  1. nef426
    Member
    Posted 2 years ago #

    I've been trying to create a close link within an inline content fancy box. I've searched around a bit and found some ideas, but none of them seem to be working.

    What i've been trying is a few variations of something like this:

    <a href="#" onClick="parent.jQuery.fancybox.close();">Close Window</a>

    I found this thread here: http://wordpress.org/support/topic/close-from-child-window-and-resize

    and from that, also tried:

    <a href="#" onClick="parent.$.fancybox.close();">Close Window</a>

    however I haven't been able to make any of them work.

    Any ideas?

    Thanks

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

  2. RavanH
    Member
    Plugin Author

    Posted 2 years ago #

    Hi, here is a working example http://www.picssel.com/playground/jquery/openFormIframeandCloseOnsubmit_02feb12.html of the code you are trying but...

    Keep in mind, this is for fancybox using iframe mode. You say you are using inline content... That would mean you do not need to call the 'parent' here as the source is embedded in the current frame.

  3. nef426
    Member
    Posted 2 years ago #

    Hi RavanH,

    Based off the example you provided, and getting rid of the 'parent' call, I tried using the following and can't seem to get it working either -

    <a href="javascript:$.jQuery.fancybox.close();">Close Window </a>

    I looked at the code and tried using the version that was actually in use in the box:

    <a href="javascript:jQuery.fancybox.close();">Close Window</a>

    this one also wouldn't work for me though --

    Thanks

  4. RavanH
    Member
    Plugin Author

    Posted 2 years ago #

    A test on http://demo.4visions.nl/easy-fancybox-sandbox/ tells me it should work. Do you get any javascript errors? If you have a link for me I could take a look...

  5. nef426
    Member
    Posted 2 years ago #

    Unfortunately I'm developing locally, so no link.

    I took the code you used in the auto open box @ your sandbox, and when I use that I get this error:

    jQuery.fancybox is undefined

    I get the same error with the other variations I mentioned above.

  6. nef426
    Member
    Posted 2 years ago #

    Not sure if it makes a difference, but for transitions in&out im using 'fade', and easing for in&out im using 'back'

  7. RavanH
    Member
    Plugin Author

    Posted 2 years ago #

    The transition and easing settings should not matter... But keeping transition to fade (or even none) is the safest for now.

    If I understand it correctly, there is no error when the inline content is opened in FancyBox but when closing, this 'undefined' error occurs? Does it also occur whan clicking the X close button or clicking outside the lightbox frame to close FancyBox?

    Is there javascript inside this content that might be breaking the FancyBox script?

    In fact, the fact that the function fancybox suddenly is completely undefined (instead of just throwing an error somewhere along the line) seems to point to the main jQuery script being loaded twice. Could you check for any script files that are linked in the page source more than once, even in different versions?

  8. nef426
    Member
    Posted 2 years ago #

    ok, found it, that fixed it.

    I had a second library linked as part of http://jquery.malsup.com/cycle/ -- even though that plugin says it can function with libraries 1.3.2+ it doesn't seem to like the ver=1.7.1 that is attached, hmmm... on to the next problem.

    Thanks for your trouble shooting help.

  9. nef426
    Member
    Posted 2 years ago #

    Just incase anyone else stumbles upon this and is using the jQuery cycle plugin with easy-fancybox. I solved the double library load issue by changing the jQuery Cycle plugin to use 'jQuery' instead of '$' per suggestion from this thread:

    http://wordpress.org/support/topic/jquery-cycle-plugin-and-other-jquery-issues?replies=2

  10. RavanH
    Member
    Plugin Author

    Posted 2 years ago #

    Excellent. Thanks for sharing the fix :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic