2019-08-14 01:50:35 +00:00
|
|
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2016-03-06 00:50:22 +00:00
|
|
|
(function(UI) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
UI.component('alert', {
|
|
|
|
|
|
|
|
defaults: {
|
2018-05-05 13:35:10 +00:00
|
|
|
fade: true,
|
|
|
|
duration: 200,
|
|
|
|
trigger: '.uk-alert-close'
|
2016-03-06 00:50:22 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
boot: function() {
|
|
|
|
|
|
|
|
// init code
|
2018-05-05 13:35:10 +00:00
|
|
|
UI.$html.on('click.alert.uikit', '[data-uk-alert]', function(e) {
|
2016-03-06 00:50:22 +00:00
|
|
|
|
|
|
|
var ele = UI.$(this);
|
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
if (!ele.data('alert')) {
|
2016-03-06 00:50:22 +00:00
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
var alert = UI.alert(ele, UI.Utils.options(ele.attr('data-uk-alert')));
|
2016-03-06 00:50:22 +00:00
|
|
|
|
|
|
|
if (UI.$(e.target).is(alert.options.trigger)) {
|
|
|
|
e.preventDefault();
|
|
|
|
alert.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
init: function() {
|
|
|
|
|
|
|
|
var $this = this;
|
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
this.on('click', this.options.trigger, function(e) {
|
2016-03-06 00:50:22 +00:00
|
|
|
e.preventDefault();
|
|
|
|
$this.close();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
close: function() {
|
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
var element = this.trigger('close.uk.alert'),
|
2016-03-06 00:50:22 +00:00
|
|
|
removeElement = function () {
|
2018-05-05 13:35:10 +00:00
|
|
|
this.trigger('closed.uk.alert').remove();
|
2016-03-06 00:50:22 +00:00
|
|
|
}.bind(this);
|
|
|
|
|
|
|
|
if (this.options.fade) {
|
2018-05-05 13:35:10 +00:00
|
|
|
element.css('overflow', 'hidden').css("max-height", element.height()).animate({
|
|
|
|
height : 0,
|
|
|
|
opacity : 0,
|
|
|
|
paddingTop : 0,
|
|
|
|
paddingBottom : 0,
|
|
|
|
marginTop : 0,
|
|
|
|
marginBottom : 0
|
2016-03-06 00:50:22 +00:00
|
|
|
}, this.options.duration, removeElement);
|
|
|
|
} else {
|
|
|
|
removeElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
})(UIkit2);
|