开发者

Stop the closing of an AJAX page displayed in fancybox?

开发者 https://www.devze.com 2023-01-29 17:33 出处:网络
How can I stop the closing of an AJAX page displayed in a fancybox? <a href=\"sample.php?name=name1&feedback=feedback1\" id=\"feedback\">feedback</a>

How can I stop the closing of an AJAX page displayed in a fancybox?

<a href="sample.php?name=name1&feedback=feedback1" id="feedback">feedback</a>

fancybox code in jquer开发者_如何学Cy...

    $("#feedback").fancybox({

        'speedIn'   :   600,
        'speedOut'  :   200,
        'centerOnScroll':   false,
        'autoDimensions':   true
        'type'          : 'ajax',
        });

sample.php page will be displayed in fancybox. once user click submit button in sample.php. fancybox closes. i need to make delay in closing after submitting feedback form(sample.php)


You didn't posted code So I can only guess:

You can add this options:

showCloseButton: false // this will hide the close button
hideOnContentClick: false // this will not close fancybox when clicked inside
hideOnOverlayClick: false // this will not closefancyvox when clicked outside

You can also manually close fancybox by calling $.fancybox.close

You can check for more in the API docs

Hope its what you need.

UPDATE:

To be able to close manually fancybox after form submit you need to post the form by ajax and close fancybox on success or failure using '$.fancybox.close'

You can bind the ajax to your form like this:

$('#yourForm').bind('submit', function() {
  $.ajax({
  url: 'yourpage.php',
  success: function(data) {
    if (data == 'Error') { alert('An error occurred')}
    else { $.fancybox.close }
  }
});

});

Check the jQuery docs to read more about the ajax() function and do some search in the official fancybox support group for more information.

0

精彩评论

暂无评论...
验证码 换一张
取 消