Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an additional option for closedPos. #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ Following the steps below you will be able to get the plugin up and running. If
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
closedPos: "absolute",// String: Position of the closed nav, defaults to absolute
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
Expand Down
7 changes: 4 additions & 3 deletions responsive-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ var responsiveNav = (function (window, document) {
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
closedPos: "absolute",// String: Position of the closed nav, defaults to absolute
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
Expand Down Expand Up @@ -208,10 +209,10 @@ var responsiveNav = (function (window, document) {

if (opts.animate) {
setTimeout(function () {
nav.style.position = "absolute";
nav.style.position = opts.closedPos;
}, opts.transition + 10);
} else {
nav.style.position = "absolute";
nav.style.position = opts.closedPos;
}

navOpen = false;
Expand Down Expand Up @@ -378,7 +379,7 @@ var responsiveNav = (function (window, document) {
// If the navigation is hidden
if (nav.className.match(/(^|\s)closed(\s|$)/)) {
setAttributes(nav, {"aria-hidden": "true"});
nav.style.position = "absolute";
nav.style.position = opts.closedPos;
}

this._createStyles();
Expand Down
13 changes: 6 additions & 7 deletions responsive-nav.min.js

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