vendor/assets/javascripts/responsive-nav.js in responsive-nav-rails-1.0.23 vs vendor/assets/javascripts/responsive-nav.js in responsive-nav-rails-1.0.24
- old
+ new
@@ -1,6 +1,6 @@
-/*! responsive-nav.js 1.0.23
+/*! responsive-nav.js 1.0.24
* https://github.com/viljamis/responsive-nav.js
* http://responsive-nav.com
*
* Copyright (c) 2013 @viljamis
* Available under the MIT license
@@ -132,20 +132,21 @@
var ResponsiveNav = function (el, options) {
var i;
// Default options
this.options = {
- animate: true, // Boolean: Use CSS3 transitions, true or false
- transition: 250, // Integer: Speed of the transition, in milliseconds
- label: "Menu", // String: Label for the navigation toggle
- insert: "after", // String: Insert the toggle before or after the navigation
- customToggle: "", // Selector: Specify the ID of a custom toggle
- openPos: "relative", // String: Position of the opened nav, relative or static
- jsClass: "js", // String: 'JS enabled' class which is added to <html> el
- init: function(){}, // Function: Init callback
- open: function(){}, // Function: Open callback
- close: function(){} // Function: Close callback
+ animate: true, // Boolean: Use CSS3 transitions, true or false
+ transition: 250, // Integer: Speed of the transition, in milliseconds
+ label: "Menu", // String: Label for the navigation toggle
+ insert: "after", // String: Insert the toggle before or after the navigation
+ customToggle: "", // Selector: Specify the ID of a custom toggle
+ openPos: "relative", // String: Position of the opened nav, relative or static
+ navClass: "nav-collapse", // String: Default CSS class. If changed, you need to edit the CSS too!
+ jsClass: "js", // String: 'JS enabled' class which is added to <html> element
+ init: function(){}, // Function: Init callback
+ open: function(){}, // Function: Open callback
+ close: function(){} // Function: Close callback
};
// User defined options
for (i in options) {
this.options[i] = options[i];
@@ -181,14 +182,13 @@
// Public methods
destroy: function () {
this._removeStyles();
removeClass(nav, "closed");
removeClass(nav, "opened");
- removeClass(nav, "nav-collapse");
+ removeClass(nav, opts.navClass);
nav.removeAttribute("style");
nav.removeAttribute("aria-hidden");
- nav = null;
removeEvent(window, "resize", this, false);
removeEvent(document.body, "touchmove", this, false);
removeEvent(navToggle, "touchstart", this, false);
removeEvent(navToggle, "touchend", this, false);
@@ -280,11 +280,11 @@
}
},
// Private methods
_init: function () {
- addClass(nav, "nav-collapse");
+ addClass(nav, opts.navClass);
addClass(nav, "closed");
hasAnimFinished = true;
navOpen = false;
this._createToggle();
@@ -419,10 +419,10 @@
_calcHeight: function () {
var savedHeight = 0;
for (var i = 0; i < nav.inner.length; i++) {
savedHeight += nav.inner[i].offsetHeight;
}
- var innerStyles = ".nav-collapse.opened{max-height:" + savedHeight + "px}";
+ var innerStyles = "." + opts.navClass + ".opened{max-height:" + savedHeight + "px}";
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = innerStyles;
} else {
styleElement.innerHTML = innerStyles;
\ No newline at end of file