Skip to content

Commit

Permalink
Bump v1.1.4. Simplify toggle func.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsn4ik committed Aug 26, 2014
1 parent b2f4114 commit 5b7905f
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 36 deletions.
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.1.3",
"version": "1.1.4",
"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.1.3 (http://vsn4ik.github.io/bootstrap-submenu)
* Bootstrap-submenu v1.1.4 (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.

18 changes: 9 additions & 9 deletions dist/js/bootstrap-submenu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Bootstrap-submenu v1.1.3 (http://vsn4ik.github.io/bootstrap-submenu)
* Bootstrap-submenu v1.1.4 (http://vsn4ik.github.io/bootstrap-submenu)
* Copyright 2014 vsn4ik
* Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE)
*/
Expand All @@ -14,7 +14,7 @@ if (typeof jQuery === 'undefined') {
function Submenupicker(element) {
this.$element = $(element);
this.$menu = this.$element.parent();
this.$submenus = this.$menu.parent().find('.dropdown-submenu');
this.$submenus = this.$menu.parent().find('.dropdown-submenu').not(this.$menu);

this.init();
}
Expand All @@ -30,22 +30,22 @@ if (typeof jQuery === 'undefined') {
this.toggle();
},
toggle: function() {
var isActive = this.$menu.hasClass('open');

this.$menu.toggleClass('open');
this.$submenus.removeClass('open');

if (!isActive) {
this.$menu.addClass('open');
}
},
keydown: function(event) {
// 13: Return, 32: Spacebar
// 38: Arrow left, 40: Arrow right

// Off vertical scrolling
if (event.keyCode == 32) {
if (/^(32|38|40)$/.test(event.keyCode)) {
event.preventDefault();
}

if (/^(38|40)$/.test(event.keyCode)) {
event.stopPropagation();
}

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.

8 changes: 8 additions & 0 deletions docs/assets/js/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
'use strict';

$(function() {
$('.dropdown > a').keydown(function() {
// 13: Return

if (event.keyCode == 13) {
$(this).dropdown('toggle');
}
});

$('.dropdown-submenu > a').submenupicker();

$('#scroll_top').click(function() {
Expand Down
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.1.3 (http://vsn4ik.github.io/bootstrap-submenu)
* Bootstrap-submenu v1.1.4 (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.

18 changes: 9 additions & 9 deletions docs/dist/js/bootstrap-submenu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Bootstrap-submenu v1.1.3 (http://vsn4ik.github.io/bootstrap-submenu)
* Bootstrap-submenu v1.1.4 (http://vsn4ik.github.io/bootstrap-submenu)
* Copyright 2014 vsn4ik
* Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE)
*/
Expand All @@ -14,7 +14,7 @@ if (typeof jQuery === 'undefined') {
function Submenupicker(element) {
this.$element = $(element);
this.$menu = this.$element.parent();
this.$submenus = this.$menu.parent().find('.dropdown-submenu');
this.$submenus = this.$menu.parent().find('.dropdown-submenu').not(this.$menu);

this.init();
}
Expand All @@ -30,22 +30,22 @@ if (typeof jQuery === 'undefined') {
this.toggle();
},
toggle: function() {
var isActive = this.$menu.hasClass('open');

this.$menu.toggleClass('open');
this.$submenus.removeClass('open');

if (!isActive) {
this.$menu.addClass('open');
}
},
keydown: function(event) {
// 13: Return, 32: Spacebar
// 38: Arrow left, 40: Arrow right

// Off vertical scrolling
if (event.keyCode == 32) {
if (/^(32|38|40)$/.test(event.keyCode)) {
event.preventDefault();
}

if (/^(38|40)$/.test(event.keyCode)) {
event.stopPropagation();
}

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.

16 changes: 8 additions & 8 deletions js/bootstrap-submenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (typeof jQuery === 'undefined') {
function Submenupicker(element) {
this.$element = $(element);
this.$menu = this.$element.parent();
this.$submenus = this.$menu.parent().find('.dropdown-submenu');
this.$submenus = this.$menu.parent().find('.dropdown-submenu').not(this.$menu);

this.init();
}
Expand All @@ -24,22 +24,22 @@ if (typeof jQuery === 'undefined') {
this.toggle();
},
toggle: function() {
var isActive = this.$menu.hasClass('open');

this.$menu.toggleClass('open');
this.$submenus.removeClass('open');

if (!isActive) {
this.$menu.addClass('open');
}
},
keydown: function(event) {
// 13: Return, 32: Spacebar
// 38: Arrow left, 40: Arrow right

// Off vertical scrolling
if (event.keyCode == 32) {
if (/^(32|38|40)$/.test(event.keyCode)) {
event.preventDefault();
}

if (/^(38|40)$/.test(event.keyCode)) {
event.stopPropagation();
}

if (/^(13|32)$/.test(event.keyCode)) {
this.toggle();
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-submenu",
"version": "1.1.3",
"version": "1.1.4",
"description": "Bootstrap Sub-Menus",
"keywords": [
"bootstrap",
Expand Down

0 comments on commit 5b7905f

Please sign in to comment.