How to use Zurb Foundation reveal with open, opened, close, closed callback functions?

后端 未结 9 542
执念已碎
执念已碎 2021-02-05 01:41

On zurb foundation\'s website at http://foundation.zurb.com/docs/reveal.php they listed some Options including

open: callback function that triggers \'before\' the

9条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-05 02:17

    Event Bindings for Zurb Foundation Reveal -

    There are a series of events that you can bind to for triggering callbacks:

    $(document).on('open.fndtn.reveal', '[data-reveal]', function () {
      // your code goes here...
    });
    
    $(document).on('opened.fndtn.reveal', '[data-reveal]', function () {
      // your code goes here...
    });
    
    $(document).on('close.fndtn.reveal', '[data-reveal]', function () {
      // your code goes here...
    });
    
    $(document).on('closed.fndtn.reveal', '[data-reveal]', function () {
      // your code goes here...
    });
    

    If you have multiple data-reveal used in single page as follows :

    Then in this situations you can trigger callback same as explained above but with little modification as shown below :

    $(document).on('open.fndtn.reveal', '#element-1[data-reveal]', function () {
      // your code goes here...
    });
    
    $(document).on('open.fndtn.reveal', '#element-2[data-reveal]', function () {
      // your code goes here...
    });
    

提交回复
热议问题