vendor/assets/javascripts/responsive-nav.js in responsive-nav-rails-1.0.21 vs vendor/assets/javascripts/responsive-nav.js in responsive-nav-rails-1.0.22
- old
+ new
@@ -1,6 +1,6 @@
-/*! responsive-nav.js v1.0.21
+/*! responsive-nav.js v1.0.22
* https://github.com/viljamis/responsive-nav.js
* http://responsive-nav.com
*
* Copyright (c) 2013 @viljamis
* Available under the MIT license
@@ -179,10 +179,11 @@
// Public methods
destroy: function () {
this._removeStyles();
removeClass(nav, "closed");
removeClass(nav, "opened");
+ removeClass(nav, "nav-collapse");
nav.removeAttribute("style");
nav.removeAttribute("aria-hidden");
nav = null;
removeEvent(window, "resize", this, false);
@@ -229,10 +230,30 @@
opts.close();
}
}
},
+ resize: function () {
+ if (window.getComputedStyle(navToggle, null).getPropertyValue("display") !== "none") {
+ setAttributes(navToggle, {"aria-hidden": "false"});
+
+ // If the navigation is hidden
+ if (nav.className.match(/(^|\s)closed(\s|$)/)) {
+ setAttributes(nav, {"aria-hidden": "true"});
+ nav.style.position = "absolute";
+ }
+
+ this._createStyles();
+ this._calcHeight();
+ } else {
+ setAttributes(navToggle, {"aria-hidden": "true"});
+ setAttributes(nav, {"aria-hidden": "false"});
+ nav.style.position = opts.openPos;
+ this._removeStyles();
+ }
+ },
+
handleEvent: function (e) {
var evt = e || window.event;
switch (evt.type) {
case "touchstart":
@@ -250,11 +271,11 @@
break;
case "keyup":
this._onKeyUp(evt);
break;
case "resize":
- this._resize(evt);
+ this.resize(evt);
break;
}
},
// Private methods
@@ -264,11 +285,11 @@
hasAnimFinished = true;
navOpen = false;
this._createToggle();
this._transitions();
- this._resize();
+ this.resize();
addEvent(window, "resize", this, false);
addEvent(document.body, "touchmove", this, false);
addEvent(navToggle, "touchstart", this, false);
addEvent(navToggle, "touchend", this, false);
@@ -399,29 +420,9 @@
} else {
styleElement.innerHTML = innerStyles;
}
innerStyles = "";
- },
-
- _resize: function () {
- if (window.getComputedStyle(navToggle, null).getPropertyValue("display") !== "none") {
- setAttributes(navToggle, {"aria-hidden": "false"});
-
- // If the navigation is hidden
- if (nav.className.match(/(^|\s)closed(\s|$)/)) {
- setAttributes(nav, {"aria-hidden": "true"});
- nav.style.position = "absolute";
- }
-
- this._createStyles();
- this._calcHeight();
- } else {
- setAttributes(navToggle, {"aria-hidden": "true"});
- setAttributes(nav, {"aria-hidden": "false"});
- nav.style.position = opts.openPos;
- this._removeStyles();
- }
}
};
return new ResponsiveNav(el, options);
};
\ No newline at end of file