Skip to content

Commit

Permalink
Bump v1.1.0. Add keydown event.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsn4ik committed Aug 26, 2014
1 parent 1d9425f commit d70f7e6
Show file tree
Hide file tree
Showing 13 changed files with 148 additions and 80 deletions.
2 changes: 1 addition & 1 deletion bootstrap
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-submenu",
"version": "1.0.7",
"version": "1.1.0",
"authors": [
"vsn4ik"
],
Expand Down
2 changes: 1 addition & 1 deletion dist/css/bootstrap-submenu.css
Original file line number Diff line number Diff line change
@@ -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)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/css/bootstrap-submenu.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion dist/js/bootstrap-submenu.js
Original file line number Diff line number Diff line change
@@ -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)
*/
Expand All @@ -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();
Expand All @@ -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();
}
}
};

Expand Down
4 changes: 2 additions & 2 deletions dist/js/bootstrap-submenu.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/dist/css/bootstrap-submenu.css
Original file line number Diff line number Diff line change
@@ -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)
*/
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/css/bootstrap-submenu.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion docs/dist/js/bootstrap-submenu.js
Original file line number Diff line number Diff line change
@@ -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)
*/
Expand All @@ -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();
Expand All @@ -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();
}
}
};

Expand Down
4 changes: 2 additions & 2 deletions docs/dist/js/bootstrap-submenu.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d70f7e6

Please sign in to comment.