Fancybox Close Reload Parent Page |
X

Congrats, You are Subscribed to Receive Updates.

Fancybox Close Reload Parent Page


Fancybox Close Reload Parent Page. There are many features come up with fancybox. We are using fancybox for many popup forms. In such a situation the changes hast to reflect on the parent page. So we have to refresh the page when the fancybox close button triggered.
There are few options to refresh the parent page. Let’s check each one.

1. Fancybox.js edit :

We can edit the fancybox plugin code make the changes. Which will reflest on all the fancyboxes.

Just find your jQuery.fancybox. js plugin file and make the changes

afterClose: function(opts) {
        if(this.overlay) {
            this.overlay.fadeOut(opts.speedOut || 0, function() {
                $(this).remove();
parent.location.reload(true);
            });
        }

But the strange thing is It will refresh all the pages wherever you use the plugin. So we should not go with it if we dont want to do it for all popups.
Here is another way, which is better to go.

2. Best way to do this. You can add an additional parameter to the fancybox function to use it.

$(".popupid").
fancybox({
            type: 'iframe',
afterClose:function () { parentlocation.reload(true);
            }
        });

That’s it. Hope this will help you to refresh the parent page after fancybox close.

commenter

About Mizanur Rahman

Comment Below

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar