bootstrap-submenu
Advanced tools
Comparing version 1.1.3 to 1.1.4
/*! | ||
* 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 | ||
@@ -17,3 +17,3 @@ * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE) | ||
this.$menu = this.$element.parent(); | ||
this.$submenus = this.$menu.parent().find('.dropdown-submenu'); | ||
this.$submenus = this.$menu.parent().find('.dropdown-submenu').not(this.$menu); | ||
@@ -34,18 +34,18 @@ this.init(); | ||
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)) { | ||
@@ -52,0 +52,0 @@ this.toggle(); |
/*! | ||
* 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 | ||
@@ -7,2 +7,2 @@ * 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.click.bind(this)),this.$element.keydown(this.keydown.bind(this))},click:function(a){a.stopPropagation(),this.toggle()},toggle:function(){var a=this.$menu.hasClass("open");this.$submenus.removeClass("open"),a||this.$menu.addClass("open")},keydown:function(a){32==a.keyCode&&a.preventDefault(),/^(13|32)$/.test(a.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); | ||
"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").not(this.$menu),this.init()}b.prototype={init:function(){this.$element.on("click.bs.dropdown",this.click.bind(this)),this.$element.keydown(this.keydown.bind(this))},click:function(a){a.stopPropagation(),this.toggle()},toggle:function(){this.$menu.toggleClass("open"),this.$submenus.removeClass("open")},keydown:function(a){/^(32|38|40)$/.test(a.keyCode)&&a.preventDefault(),/^(38|40)$/.test(a.keyCode)&&a.stopPropagation(),/^(13|32)$/.test(a.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); |
@@ -11,3 +11,3 @@ 'use strict'; | ||
this.$menu = this.$element.parent(); | ||
this.$submenus = this.$menu.parent().find('.dropdown-submenu'); | ||
this.$submenus = this.$menu.parent().find('.dropdown-submenu').not(this.$menu); | ||
@@ -28,18 +28,18 @@ this.init(); | ||
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)) { | ||
@@ -46,0 +46,0 @@ this.toggle(); |
{ | ||
"name": "bootstrap-submenu", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Bootstrap Sub-Menus", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11171
161