diff --git a/bootstrap b/bootstrap index 1517bea..b1bb573 160000 --- a/bootstrap +++ b/bootstrap @@ -1 +1 @@ -Subproject commit 1517bea4e272935a31fdc0caaa9a924bb8346ca3 +Subproject commit b1bb57360cf494693abb623390263d27b7d97195 diff --git a/bower.json b/bower.json index d995542..8b95bd7 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "bootstrap-submenu", - "version": "1.0.7", + "version": "1.1.0", "authors": [ "vsn4ik" ], diff --git a/dist/css/bootstrap-submenu.css b/dist/css/bootstrap-submenu.css index 535fe24..7b6c20c 100644 --- a/dist/css/bootstrap-submenu.css +++ b/dist/css/bootstrap-submenu.css @@ -1,5 +1,5 @@ /*! - * Bootstrap-submenu v1.0.7 (http://vsn4ik.github.io/bootstrap-submenu) + * Bootstrap-submenu v1.1.0 (http://vsn4ik.github.io/bootstrap-submenu) * Copyright 2014 vsn4ik * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE) */ diff --git a/dist/css/bootstrap-submenu.min.css b/dist/css/bootstrap-submenu.min.css index eb87ec1..5a00bfa 100644 --- a/dist/css/bootstrap-submenu.min.css +++ b/dist/css/bootstrap-submenu.min.css @@ -1,5 +1,5 @@ /*! - * Bootstrap-submenu v1.0.7 (http://vsn4ik.github.io/bootstrap-submenu) + * Bootstrap-submenu v1.1.0 (http://vsn4ik.github.io/bootstrap-submenu) * Copyright 2014 vsn4ik * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE) */ diff --git a/dist/js/bootstrap-submenu.js b/dist/js/bootstrap-submenu.js index a66b299..4f5989f 100644 --- a/dist/js/bootstrap-submenu.js +++ b/dist/js/bootstrap-submenu.js @@ -1,5 +1,5 @@ /*! - * Bootstrap-submenu v1.0.7 (http://vsn4ik.github.io/bootstrap-submenu) + * Bootstrap-submenu v1.1.0 (http://vsn4ik.github.io/bootstrap-submenu) * Copyright 2014 vsn4ik * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE) */ @@ -22,6 +22,7 @@ if (typeof jQuery === 'undefined') { Submenupicker.prototype = { init: function() { this.$element.on('click.bs.dropdown', this.toggle.bind(this)); + this.$menu.keydown(this.keydown.bind(this)); }, toggle: function() { event.stopPropagation(); @@ -33,6 +34,18 @@ if (typeof jQuery === 'undefined') { if (!isActive) { this.$menu.addClass('open'); } + }, + keydown: function() { + // 13: Return, 32: Spacebar + + // Off vertical scrolling + if (event.keyCode == 32) { + event.preventDefault(); + } + + if (/^(13|32)$/.test(event.keyCode)) { + this.toggle(); + } } }; diff --git a/dist/js/bootstrap-submenu.min.js b/dist/js/bootstrap-submenu.min.js index 6f21f0b..1011bd1 100644 --- a/dist/js/bootstrap-submenu.min.js +++ b/dist/js/bootstrap-submenu.min.js @@ -1,7 +1,7 @@ /*! - * Bootstrap-submenu v1.0.7 (http://vsn4ik.github.io/bootstrap-submenu) + * Bootstrap-submenu v1.1.0 (http://vsn4ik.github.io/bootstrap-submenu) * Copyright 2014 vsn4ik * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE) */ -"use strict";if("undefined"==typeof jQuery)throw new Error("Bootstrap-submenu requires jQuery");!function(a){function b(b){this.$element=a(b),this.$menu=this.$element.parent(),this.$submenus=this.$menu.parent().find(".dropdown-submenu"),this.init()}b.prototype={init:function(){this.$element.on("click.bs.dropdown",this.toggle.bind(this))},toggle:function(){event.stopPropagation();var a=this.$menu.hasClass("open");this.$submenus.removeClass("open"),a||this.$menu.addClass("open")}},a.fn.submenupicker=function(){return this.each(function(){var c=a(this),d=c.data("bs.submenu");d||(new b(this),c.data("bs.submenu",!0))})}}(jQuery); \ No newline at end of file +"use strict";if("undefined"==typeof jQuery)throw new Error("Bootstrap-submenu requires jQuery");!function(a){function b(b){this.$element=a(b),this.$menu=this.$element.parent(),this.$submenus=this.$menu.parent().find(".dropdown-submenu"),this.init()}b.prototype={init:function(){this.$element.on("click.bs.dropdown",this.toggle.bind(this)),this.$menu.keydown(this.keydown.bind(this))},toggle:function(){event.stopPropagation();var a=this.$menu.hasClass("open");this.$submenus.removeClass("open"),a||this.$menu.addClass("open")},keydown:function(){32==event.keyCode&&event.preventDefault(),/^(13|32)$/.test(event.keyCode)&&this.toggle()}},a.fn.submenupicker=function(){return this.each(function(){var c=a(this),d=c.data("bs.submenu");d||(new b(this),c.data("bs.submenu",!0))})}}(jQuery); \ No newline at end of file diff --git a/docs/dist/css/bootstrap-submenu.css b/docs/dist/css/bootstrap-submenu.css index 535fe24..7b6c20c 100644 --- a/docs/dist/css/bootstrap-submenu.css +++ b/docs/dist/css/bootstrap-submenu.css @@ -1,5 +1,5 @@ /*! - * Bootstrap-submenu v1.0.7 (http://vsn4ik.github.io/bootstrap-submenu) + * Bootstrap-submenu v1.1.0 (http://vsn4ik.github.io/bootstrap-submenu) * Copyright 2014 vsn4ik * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE) */ diff --git a/docs/dist/css/bootstrap-submenu.min.css b/docs/dist/css/bootstrap-submenu.min.css index eb87ec1..5a00bfa 100644 --- a/docs/dist/css/bootstrap-submenu.min.css +++ b/docs/dist/css/bootstrap-submenu.min.css @@ -1,5 +1,5 @@ /*! - * Bootstrap-submenu v1.0.7 (http://vsn4ik.github.io/bootstrap-submenu) + * Bootstrap-submenu v1.1.0 (http://vsn4ik.github.io/bootstrap-submenu) * Copyright 2014 vsn4ik * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE) */ diff --git a/docs/dist/js/bootstrap-submenu.js b/docs/dist/js/bootstrap-submenu.js index a66b299..4f5989f 100644 --- a/docs/dist/js/bootstrap-submenu.js +++ b/docs/dist/js/bootstrap-submenu.js @@ -1,5 +1,5 @@ /*! - * Bootstrap-submenu v1.0.7 (http://vsn4ik.github.io/bootstrap-submenu) + * Bootstrap-submenu v1.1.0 (http://vsn4ik.github.io/bootstrap-submenu) * Copyright 2014 vsn4ik * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE) */ @@ -22,6 +22,7 @@ if (typeof jQuery === 'undefined') { Submenupicker.prototype = { init: function() { this.$element.on('click.bs.dropdown', this.toggle.bind(this)); + this.$menu.keydown(this.keydown.bind(this)); }, toggle: function() { event.stopPropagation(); @@ -33,6 +34,18 @@ if (typeof jQuery === 'undefined') { if (!isActive) { this.$menu.addClass('open'); } + }, + keydown: function() { + // 13: Return, 32: Spacebar + + // Off vertical scrolling + if (event.keyCode == 32) { + event.preventDefault(); + } + + if (/^(13|32)$/.test(event.keyCode)) { + this.toggle(); + } } }; diff --git a/docs/dist/js/bootstrap-submenu.min.js b/docs/dist/js/bootstrap-submenu.min.js index 6f21f0b..1011bd1 100644 --- a/docs/dist/js/bootstrap-submenu.min.js +++ b/docs/dist/js/bootstrap-submenu.min.js @@ -1,7 +1,7 @@ /*! - * Bootstrap-submenu v1.0.7 (http://vsn4ik.github.io/bootstrap-submenu) + * Bootstrap-submenu v1.1.0 (http://vsn4ik.github.io/bootstrap-submenu) * Copyright 2014 vsn4ik * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE) */ -"use strict";if("undefined"==typeof jQuery)throw new Error("Bootstrap-submenu requires jQuery");!function(a){function b(b){this.$element=a(b),this.$menu=this.$element.parent(),this.$submenus=this.$menu.parent().find(".dropdown-submenu"),this.init()}b.prototype={init:function(){this.$element.on("click.bs.dropdown",this.toggle.bind(this))},toggle:function(){event.stopPropagation();var a=this.$menu.hasClass("open");this.$submenus.removeClass("open"),a||this.$menu.addClass("open")}},a.fn.submenupicker=function(){return this.each(function(){var c=a(this),d=c.data("bs.submenu");d||(new b(this),c.data("bs.submenu",!0))})}}(jQuery); \ No newline at end of file +"use strict";if("undefined"==typeof jQuery)throw new Error("Bootstrap-submenu requires jQuery");!function(a){function b(b){this.$element=a(b),this.$menu=this.$element.parent(),this.$submenus=this.$menu.parent().find(".dropdown-submenu"),this.init()}b.prototype={init:function(){this.$element.on("click.bs.dropdown",this.toggle.bind(this)),this.$menu.keydown(this.keydown.bind(this))},toggle:function(){event.stopPropagation();var a=this.$menu.hasClass("open");this.$submenus.removeClass("open"),a||this.$menu.addClass("open")},keydown:function(){32==event.keyCode&&event.preventDefault(),/^(13|32)$/.test(event.keyCode)&&this.toggle()}},a.fn.submenupicker=function(){return this.each(function(){var c=a(this),d=c.data("bs.submenu");d||(new b(this),c.data("bs.submenu",!0))})}}(jQuery); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 836d32f..c739b20 100644 --- a/docs/index.html +++ b/docs/index.html @@ -31,6 +31,35 @@