How to close a jQuery fancybox from button click

前端 未结 9 1058
你的背包
你的背包 2021-01-01 15:52

I\'m using fancy box to create a popup and load another page on it using an iframe. here is my code

    

        
9条回答
  •  盖世英雄少女心
    2021-01-01 16:32

    This is an old thread but I thought I'd share my two cents.

    I was having similar issues with closing the fancybox iframe using the onclick event and after many tries, this did the trick for me: window.parent.jQuery.fancybox.close()

    Here's an example using an input button:

    
    

    As well, I tested the onlick on an anchor (a) tag and it worked fine.

提交回复
热议问题