From c94fb32c7a3c28b18a27460aa2447eeec1fac1de Mon Sep 17 00:00:00 2001 From: Pascal Szewczyk Date: Mon, 18 Jul 2016 23:23:54 +0200 Subject: uikit added --- js/core/alert.js | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 js/core/alert.js (limited to 'js/core/alert.js') diff --git a/js/core/alert.js b/js/core/alert.js new file mode 100755 index 0000000..e145d5f --- /dev/null +++ b/js/core/alert.js @@ -0,0 +1,66 @@ +/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ +(function(UI) { + + "use strict"; + + UI.component('alert', { + + defaults: { + "fade": true, + "duration": 200, + "trigger": ".uk-alert-close" + }, + + boot: function() { + + // init code + UI.$html.on("click.alert.uikit", "[data-uk-alert]", function(e) { + + var ele = UI.$(this); + + if (!ele.data("alert")) { + + var alert = UI.alert(ele, UI.Utils.options(ele.attr("data-uk-alert"))); + + if (UI.$(e.target).is(alert.options.trigger)) { + e.preventDefault(); + alert.close(); + } + } + }); + }, + + init: function() { + + var $this = this; + + this.on("click", this.options.trigger, function(e) { + e.preventDefault(); + $this.close(); + }); + }, + + close: function() { + + var element = this.trigger("close.uk.alert"), + removeElement = function () { + this.trigger("closed.uk.alert").remove(); + }.bind(this); + + if (this.options.fade) { + element.css("overflow", "hidden").css("max-height", element.height()).animate({ + "height" : 0, + "opacity" : 0, + "padding-top" : 0, + "padding-bottom" : 0, + "margin-top" : 0, + "margin-bottom" : 0 + }, this.options.duration, removeElement); + } else { + removeElement(); + } + } + + }); + +})(UIkit); -- cgit v1.2.3