foundation.alert.js 853 B

12345678910111213141516171819202122232425262728293031323334
  1. ;(function ($, window, document, undefined) {
  2. 'use strict';
  3. Foundation.libs.alert = {
  4. name : 'alert',
  5. version : '5.0.0',
  6. settings : {
  7. animation: 'fadeOut',
  8. speed: 300, // fade out speed
  9. callback: function (){}
  10. },
  11. init : function (scope, method, options) {
  12. this.bindings(method, options);
  13. },
  14. events : function () {
  15. $(this.scope).off('.alert').on('click.fndtn.alert', '[data-alert] a.close', function (e) {
  16. var alertBox = $(this).closest("[data-alert]"),
  17. settings = alertBox.data('alert-init');
  18. e.preventDefault();
  19. alertBox[settings.animation](settings.speed, function () {
  20. $(this).trigger('closed').remove();
  21. settings.callback();
  22. });
  23. });
  24. },
  25. reflow : function () {}
  26. };
  27. }(jQuery, this, this.document));