@@ 1745-1809 (lines=65) @@ | ||
1742 | ||
1743 | })(UIkit2); |
|
1744 | ||
1745 | (function(UI) { |
|
1746 | ||
1747 | "use strict"; |
|
1748 | ||
1749 | UI.component('alert', { |
|
1750 | ||
1751 | defaults: { |
|
1752 | fade: true, |
|
1753 | duration: 200, |
|
1754 | trigger: '.uk-alert-close' |
|
1755 | }, |
|
1756 | ||
1757 | boot: function() { |
|
1758 | ||
1759 | // init code |
|
1760 | UI.$html.on('click.alert.uikit', '[data-uk-alert]', function(e) { |
|
1761 | ||
1762 | var ele = UI.$(this); |
|
1763 | ||
1764 | if (!ele.data('alert')) { |
|
1765 | ||
1766 | var alert = UI.alert(ele, UI.Utils.options(ele.attr('data-uk-alert'))); |
|
1767 | ||
1768 | if (UI.$(e.target).is(alert.options.trigger)) { |
|
1769 | e.preventDefault(); |
|
1770 | alert.close(); |
|
1771 | } |
|
1772 | } |
|
1773 | }); |
|
1774 | }, |
|
1775 | ||
1776 | init: function() { |
|
1777 | ||
1778 | var $this = this; |
|
1779 | ||
1780 | this.on('click', this.options.trigger, function(e) { |
|
1781 | e.preventDefault(); |
|
1782 | $this.close(); |
|
1783 | }); |
|
1784 | }, |
|
1785 | ||
1786 | close: function() { |
|
1787 | ||
1788 | var element = this.trigger('close.uk.alert'), |
|
1789 | removeElement = function () { |
|
1790 | this.trigger('closed.uk.alert').remove(); |
|
1791 | }.bind(this); |
|
1792 | ||
1793 | if (this.options.fade) { |
|
1794 | element.css('overflow', 'hidden').css("max-height", element.height()).animate({ |
|
1795 | height : 0, |
|
1796 | opacity : 0, |
|
1797 | paddingTop : 0, |
|
1798 | paddingBottom : 0, |
|
1799 | marginTop : 0, |
|
1800 | marginBottom : 0 |
|
1801 | }, this.options.duration, removeElement); |
|
1802 | } else { |
|
1803 | removeElement(); |
|
1804 | } |
|
1805 | } |
|
1806 | ||
1807 | }); |
|
1808 | ||
1809 | })(UIkit2); |
|
1810 | ||
1811 | (function(UI) { |
|
1812 |
@@ 2-66 (lines=65) @@ | ||
1 | /*! UIkit 2.27.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ |
|
2 | (function(UI) { |
|
3 | ||
4 | "use strict"; |
|
5 | ||
6 | UI.component('alert', { |
|
7 | ||
8 | defaults: { |
|
9 | fade: true, |
|
10 | duration: 200, |
|
11 | trigger: '.uk-alert-close' |
|
12 | }, |
|
13 | ||
14 | boot: function() { |
|
15 | ||
16 | // init code |
|
17 | UI.$html.on('click.alert.uikit', '[data-uk-alert]', function(e) { |
|
18 | ||
19 | var ele = UI.$(this); |
|
20 | ||
21 | if (!ele.data('alert')) { |
|
22 | ||
23 | var alert = UI.alert(ele, UI.Utils.options(ele.attr('data-uk-alert'))); |
|
24 | ||
25 | if (UI.$(e.target).is(alert.options.trigger)) { |
|
26 | e.preventDefault(); |
|
27 | alert.close(); |
|
28 | } |
|
29 | } |
|
30 | }); |
|
31 | }, |
|
32 | ||
33 | init: function() { |
|
34 | ||
35 | var $this = this; |
|
36 | ||
37 | this.on('click', this.options.trigger, function(e) { |
|
38 | e.preventDefault(); |
|
39 | $this.close(); |
|
40 | }); |
|
41 | }, |
|
42 | ||
43 | close: function() { |
|
44 | ||
45 | var element = this.trigger('close.uk.alert'), |
|
46 | removeElement = function () { |
|
47 | this.trigger('closed.uk.alert').remove(); |
|
48 | }.bind(this); |
|
49 | ||
50 | if (this.options.fade) { |
|
51 | element.css('overflow', 'hidden').css("max-height", element.height()).animate({ |
|
52 | height : 0, |
|
53 | opacity : 0, |
|
54 | paddingTop : 0, |
|
55 | paddingBottom : 0, |
|
56 | marginTop : 0, |
|
57 | marginBottom : 0 |
|
58 | }, this.options.duration, removeElement); |
|
59 | } else { |
|
60 | removeElement(); |
|
61 | } |
|
62 | } |
|
63 | ||
64 | }); |
|
65 | ||
66 | })(UIkit2); |
|
67 |