updated Uikit v2

This commit is contained in:
2017-11-12 02:33:10 +02:00
parent 7d27af5d59
commit 1cc40dbfe4
437 changed files with 9171 additions and 5797 deletions

View File

@@ -1,4 +1,4 @@
/*! UIkit 2.25.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
/*! UIkit 2.27.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(UI) {
"use strict";
@@ -6,9 +6,9 @@
UI.component('nav', {
defaults: {
"toggle": ">li.uk-parent > a[href='#']",
"lists": ">li.uk-parent > ul",
"multiple": false
toggle: '>li.uk-parent > a[href="#"]',
lists: '>li.uk-parent > ul',
multiple: false
},
boot: function() {
@@ -16,11 +16,11 @@
// init code
UI.ready(function(context) {
UI.$("[data-uk-nav]", context).each(function() {
UI.$('[data-uk-nav]', context).each(function() {
var nav = UI.$(this);
if (!nav.data("nav")) {
var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
if (!nav.data('nav')) {
var obj = UI.nav(nav, UI.Utils.options(nav.attr('data-uk-nav')));
}
});
});
@@ -30,26 +30,41 @@
var $this = this;
this.on("click.uk.nav", this.options.toggle, function(e) {
this.on('click.uk.nav', this.options.toggle, function(e) {
e.preventDefault();
var ele = UI.$(this);
$this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
});
this.update();
UI.domObserve(this.element, function(e) {
if ($this.element.find($this.options.lists).not('[role]').length) {
$this.update();
}
});
},
update: function() {
var $this = this;
this.find(this.options.lists).each(function() {
var $ele = UI.$(this),
parent = $ele.parent(),
var $ele = UI.$(this).attr('role', 'menu'),
parent = $ele.closest('li'),
active = parent.hasClass("uk-active");
$ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
parent.data("list-container", $ele.parent()[active ? 'removeClass':'addClass']('uk-hidden'));
if (!parent.data('list-container')) {
$ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
parent.data('list-container', $ele.parent()[active ? 'removeClass':'addClass']('uk-hidden'));
}
// Init ARIA
parent.attr('aria-expanded', parent.hasClass("uk-open"));
if (active) $this.open(parent, true);
});
},
open: function(li, noanimation) {
@@ -114,15 +129,17 @@
// helper
function getHeight(ele) {
var $ele = UI.$(ele), height = "auto";
if ($ele.is(":visible")) {
var $ele = UI.$(ele), height = 'auto';
if ($ele.is(':visible')) {
height = $ele.outerHeight();
} else {
var tmp = {
position: $ele.css("position"),
visibility: $ele.css("visibility"),
display: $ele.css("display")
position: $ele.css('position'),
visibility: $ele.css('visibility'),
display: $ele.css('display')
};
height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
@@ -133,4 +150,4 @@
return height;
}
})(UIkit);
})(UIkit2);