Friday, October 4, 2013

Fancy Box - how to refresh parent page when close iframe popup?


index file inside the head  tag

<script>
        $(document).ready(function() {
            //$('.fancybox').fancybox();
        $(".fancybox").fancybox({
            type: 'iframe',
            afterClose: function () { // USE THIS IT IS YOUR ANSWER THE KEY WORD IS "afterClose"
                parent.location.reload(true);
            }
        });
        });
   
        </script>

index file body tag

<a class="fancybox fancybox.iframe" href="adduser.php" ><u>ADD USER</u></a>

OR YOU CAN DO THIS TOO
Go to your jquery.fancybox.js file and go line 1380 it is look like this and add "parent.location.reload(true);"

  jquery.fancybox.js


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

        this.overlay = null;
    }
 
 

No comments:

Post a Comment