foundation.alert.js 962 B

12345678910111213141516171819202122232425262728293031323334353637
  1. ;(function ($, window, document, undefined) {
  2. 'use strict';
  3. Foundation.libs.alert = {
  4. name : 'alert',
  5. version : '5.1.1',
  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. var self = this,
  16. S = this.S;
  17. $(this.scope).off('.alert').on('click.fndtn.alert', '[' + this.attr_name() + '] a.close', function (e) {
  18. var alertBox = S(this).closest('[' + self.attr_name() + ']'),
  19. settings = alertBox.data(self.attr_name(true) + '-init') || self.settings;
  20. e.preventDefault();
  21. alertBox[settings.animation](settings.speed, function () {
  22. S(this).trigger('closed').remove();
  23. settings.callback();
  24. });
  25. });
  26. },
  27. reflow : function () {}
  28. };
  29. }(jQuery, this, this.document));