Jquery - fancybox and callback

前端 未结 7 1665
借酒劲吻你
借酒劲吻你 2020-12-31 17:36

I have problem with fancybox.
I want to write a function that will run when the fancybox opened. How and when to call the function?

Example:

func         


        
7条回答
  •  半阙折子戏
    2020-12-31 17:43

    The newest way how to make it work is using afterShow or beforeShow:

    $("a#registrace").fancybox({
      beforeShow   : function() {
        alert('its working!');
        validate_reg_form();
      }
    });
    

    I am loading registration form through ajax and I need to enable form-validation. In both cases (before and after), the content is already loaded.

提交回复
热议问题