updated Uikit v2
This commit is contained in:
@@ -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,24 +6,24 @@
|
||||
UI.component('buttonRadio', {
|
||||
|
||||
defaults: {
|
||||
"activeClass": 'uk-active',
|
||||
"target": ".uk-button"
|
||||
activeClass: 'uk-active',
|
||||
target: '.uk-button'
|
||||
},
|
||||
|
||||
boot: function() {
|
||||
|
||||
// init code
|
||||
UI.$html.on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
|
||||
UI.$html.on('click.buttonradio.uikit', '[data-uk-button-radio]', function(e) {
|
||||
|
||||
var ele = UI.$(this);
|
||||
|
||||
if (!ele.data("buttonRadio")) {
|
||||
if (!ele.data('buttonRadio')) {
|
||||
|
||||
var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio"))),
|
||||
var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr('data-uk-button-radio'))),
|
||||
target = UI.$(e.target);
|
||||
|
||||
if (target.is(obj.options.target)) {
|
||||
target.trigger("click");
|
||||
target.trigger('click');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -36,7 +36,7 @@
|
||||
// Init ARIA
|
||||
this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
|
||||
|
||||
this.on("click", this.options.target, function(e) {
|
||||
this.on('click', this.options.target, function(e) {
|
||||
|
||||
var ele = UI.$(this);
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
$this.find($this.options.target).not(ele).attr('aria-checked', 'false');
|
||||
ele.attr('aria-checked', 'true');
|
||||
|
||||
$this.trigger("change.uk.button", [ele]);
|
||||
$this.trigger('change.uk.button', [ele]);
|
||||
});
|
||||
|
||||
},
|
||||
@@ -62,22 +62,22 @@
|
||||
UI.component('buttonCheckbox', {
|
||||
|
||||
defaults: {
|
||||
"activeClass": 'uk-active',
|
||||
"target": ".uk-button"
|
||||
activeClass: 'uk-active',
|
||||
target: '.uk-button'
|
||||
},
|
||||
|
||||
boot: function() {
|
||||
|
||||
UI.$html.on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
|
||||
UI.$html.on('click.buttoncheckbox.uikit', '[data-uk-button-checkbox]', function(e) {
|
||||
var ele = UI.$(this);
|
||||
|
||||
if (!ele.data("buttonCheckbox")) {
|
||||
if (!ele.data('buttonCheckbox')) {
|
||||
|
||||
var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))),
|
||||
var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr('data-uk-button-checkbox'))),
|
||||
target = UI.$(e.target);
|
||||
|
||||
if (target.is(obj.options.target)) {
|
||||
target.trigger("click");
|
||||
target.trigger('click');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -90,7 +90,7 @@
|
||||
// Init ARIA
|
||||
this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
|
||||
|
||||
this.on("click", this.options.target, function(e) {
|
||||
this.on('click', this.options.target, function(e) {
|
||||
var ele = UI.$(this);
|
||||
|
||||
if (ele.is('a[href="#"]')) e.preventDefault();
|
||||
@@ -100,7 +100,7 @@
|
||||
// Update ARIA
|
||||
ele.attr('aria-checked', ele.hasClass($this.options.activeClass));
|
||||
|
||||
$this.trigger("change.uk.button", [ele]);
|
||||
$this.trigger('change.uk.button', [ele]);
|
||||
});
|
||||
|
||||
},
|
||||
@@ -117,13 +117,13 @@
|
||||
|
||||
boot: function() {
|
||||
|
||||
UI.$html.on("click.button.uikit", "[data-uk-button]", function(e) {
|
||||
UI.$html.on('click.button.uikit', '[data-uk-button]', function(e) {
|
||||
var ele = UI.$(this);
|
||||
|
||||
if (!ele.data("button")) {
|
||||
if (!ele.data('button')) {
|
||||
|
||||
var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button")));
|
||||
ele.trigger("click");
|
||||
var obj = UI.button(ele, UI.Utils.options(ele.attr('data-uk-button')));
|
||||
ele.trigger('click');
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -135,23 +135,22 @@
|
||||
// Init ARIA
|
||||
this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
|
||||
|
||||
this.on("click", function(e) {
|
||||
this.on('click', function(e) {
|
||||
|
||||
if ($this.element.is('a[href="#"]')) e.preventDefault();
|
||||
|
||||
$this.toggle();
|
||||
$this.trigger("change.uk.button", [$this.element.blur().hasClass("uk-active")]);
|
||||
$this.trigger('change.uk.button', [$this.element.blur().hasClass('uk-active')]);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
toggle: function() {
|
||||
this.element.toggleClass("uk-active");
|
||||
this.element.toggleClass('uk-active');
|
||||
|
||||
// Update ARIA
|
||||
this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
|
||||
this.element.attr('aria-pressed', this.element.hasClass('uk-active'));
|
||||
}
|
||||
});
|
||||
|
||||
})(UIkit);
|
||||
|
||||
})(UIkit2);
|
||||
|
Reference in New Issue
Block a user