How to Auto close fancybox after 5 seconds jQuery

This script is used if you want to auto close the fancybox popup.it works with ajax. Copy this code and add it in the footer or header file of your theme.

<script type="text/javascript">
jQuery(function(){ 
jQuery('.class or #id').ajaxComplete(function(event,XMLHttpRequest, ajaxOptions){
setTimeout( function() {jQuery.fancybox.close(); },5000);
});
});
</script>

Share With Friends

Speak Your Mind

*

Time limit is exhausted. Please reload CAPTCHA.