]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
default settings fallback for alert.js 3841/head
authortomasz stryjewski <stryjewski.t@gmail.com>
Mon, 9 Dec 2013 14:20:46 +0000 (15:20 +0100)
committertomasz stryjewski <stryjewski.t@gmail.com>
Mon, 9 Dec 2013 14:20:46 +0000 (15:20 +0100)
when adding alert boxes dynamically, the settings option on the alert-box is empty and throws an error when trying to close the alert-box.

this change allows to fall back to default settings, which otherwise are not accessible

js/foundation/foundation.alert.js

index 7350578adc40664b317388a42fcd18ad37e8ecc0..569d40e9a1ba7fb0761d4ec164bf4a2390d04345 100644 (file)
@@ -19,7 +19,7 @@
     events : function () {
       $(this.scope).off('.alert').on('click.fndtn.alert', '[data-alert] a.close', function (e) {
           var alertBox = $(this).closest("[data-alert]"),
-              settings = alertBox.data('alert-init');
+              settings = alertBox.data('alert-init') || Foundation.libs.alert.settings;
 
         e.preventDefault();
         alertBox[settings.animation](settings.speed, function () {
@@ -31,4 +31,4 @@
 
     reflow : function () {}
   };
-}(jQuery, this, this.document));
\ No newline at end of file
+}(jQuery, this, this.document));