├── .editorconfig ├── .gitignore ├── .htmlhintrc ├── LICENSE ├── README.md ├── bower.json ├── demo.gif ├── dist ├── example.css ├── example.js ├── example.min.css ├── example.min.js ├── jquery-stack-menu.css ├── jquery-stack-menu.js ├── jquery-stack-menu.min.css └── jquery-stack-menu.min.js ├── docs ├── example.min.css ├── example.min.js ├── index.html ├── jquery-stack-menu.min.css └── jquery-stack-menu.min.js ├── gulpfile.js ├── package.json └── src ├── coffee ├── example.coffee └── jquery-stack-menu.coffee ├── pug └── index.pug └── stylus ├── example.styl └── jquery-stack-menu.styl /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = tab 6 | indent_size = 2 7 | end_of_line = lf 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | bower_components/ 4 | node_modules/ 5 | src/js/app.js 6 | dist/*.html 7 | dist/templates/site/assets/scripts 8 | dist/templates/site/assets/json 9 | dist/templates/site/assets/styles 10 | dist/templates/site/assets/templates 11 | -------------------------------------------------------------------------------- /.htmlhintrc: -------------------------------------------------------------------------------- 1 | { 2 | "tagname-lowercase": true, 3 | "attr-lowercase": true, 4 | "attr-value-double-quotes": true, 5 | "doctype-first": true, 6 | "tag-pair": true, 7 | "spec-char-escape": true, 8 | "id-unique": true, 9 | "src-not-empty": true, 10 | "attr-no-duplication": true, 11 | "title-require": true, 12 | "alt-require": true, 13 | "doctype-html5": true 14 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Max Zhurkin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jQuery Stack Menu 2 | 3 | The plugin make simply navigation menu from unordered list 4 | 5 |  6 | 7 | [VIEW DEMO](https://maximzhurkin.github.io/jquery-stack-menu/) 8 | 9 | ## Getting Started 10 | ### 1. Include [jQuery](https://jquery.com/) and stackMenu 11 | ```html 12 |
13 | 14 | 15 | 16 | 17 | ``` 18 | ### 2. Add HTML 19 | ```html 20 | 35 | ``` 36 | ### 3. Call plugin 37 | ```javascript 38 | $(document).ready(function() { 39 | $('#stack-menu').stackMenu(); 40 | }); 41 | ``` 42 | ## Options 43 | ```javascript 44 | $('#stack-menu').stackMenu({ 45 | all: false, // add links to parents 46 | allTitle: 'All' // parents links text 47 | }); 48 | ``` 49 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-slide-menu", 3 | "description": "jQuery slide menu plugin", 4 | "main": "index.js", 5 | "authors": [ 6 | "Max Zhurkin" 7 | ], 8 | "license": "ISC", 9 | "homepage": "", 10 | "ignore": [ 11 | "**/.*", 12 | "node_modules", 13 | "bower_components", 14 | "test", 15 | "tests" 16 | ], 17 | "dependencies": { 18 | "jquery": "^3.4.1", 19 | "reset-stylus": "*", 20 | "reset-additional": "https://github.com/maximzhurkin/reset-additional.git" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximzhurkin/jquery-stack-menu/94b4574c00d63cfc2a9d2e0dfd66636699c275b2/demo.gif -------------------------------------------------------------------------------- /dist/example.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 60px; 3 | padding-bottom: 60px; 4 | font-family: 'Roboto', sans-serif; 5 | background-color: #f9f9f9; 6 | } 7 | .header, 8 | .footer { 9 | text-align: center; 10 | } 11 | .header { 12 | margin-bottom: 60px; 13 | } 14 | .header__heading { 15 | margin-top: 0; 16 | margin-bottom: 20px; 17 | font-weight: 900; 18 | font-size: 30px; 19 | line-height: 1em; 20 | } 21 | .header__description { 22 | font-size: 16px; 23 | font-weight: 300; 24 | } 25 | .header__link { 26 | margin-left: 10px; 27 | margin-right: 10px; 28 | font-weight: 700; 29 | color: #007aff; 30 | text-decoration: none; 31 | border-bottom: 2px solid rgba(0,122,255,0.2); 32 | -webkit-transition: border-color 0.25s ease-in-out; 33 | -moz-transition: border-color 0.25s ease-in-out; 34 | transition: border-color 0.25s ease-in-out; 35 | } 36 | .header__link:hover { 37 | border-color: #007aff; 38 | } 39 | .menu { 40 | margin-left: auto; 41 | margin-right: auto; 42 | margin-bottom: 60px; 43 | width: 200px; 44 | font-weight: 500; 45 | font-size: 14px; 46 | } 47 | .footer { 48 | font-size: 12px; 49 | font-weight: 300; 50 | } 51 | .footer__link { 52 | color: #000; 53 | text-decoration: none; 54 | border-bottom: 1px solid rgba(0,0,0,0.2); 55 | -webkit-transition: border-color 0.25s ease-in-out; 56 | -moz-transition: border-color 0.25s ease-in-out; 57 | transition: border-color 0.25s ease-in-out; 58 | } 59 | .footer__link:hover { 60 | border-color: #000; 61 | } 62 | -------------------------------------------------------------------------------- /dist/example.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $('#stack-menu').stackMenu(); 3 | }); 4 | -------------------------------------------------------------------------------- /dist/example.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:60px;padding-bottom:60px;font-family:'Roboto',sans-serif;background-color:#f9f9f9}.footer,.header{text-align:center}.header{margin-bottom:60px}.header__heading{margin-top:0;margin-bottom:20px;font-weight:900;font-size:30px;line-height:1em}.header__description{font-size:16px;font-weight:300}.header__link{margin-left:10px;margin-right:10px;font-weight:700;color:#007aff;text-decoration:none;border-bottom:2px solid rgba(0,122,255,.2);-webkit-transition:border-color .25s ease-in-out;-moz-transition:border-color .25s ease-in-out;transition:border-color .25s ease-in-out}.header__link:hover{border-color:#007aff}.menu{margin-left:auto;margin-right:auto;margin-bottom:60px;width:200px;font-weight:500;font-size:14px}.footer{font-size:12px;font-weight:300}.footer__link{color:#000;text-decoration:none;border-bottom:1px solid rgba(0,0,0,.2);-webkit-transition:border-color .25s ease-in-out;-moz-transition:border-color .25s ease-in-out;transition:border-color .25s ease-in-out}.footer__link:hover{border-color:#000} -------------------------------------------------------------------------------- /dist/example.min.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){$("#stack-menu").stackMenu()}); -------------------------------------------------------------------------------- /dist/jquery-stack-menu.css: -------------------------------------------------------------------------------- 1 | .stack-menu { 2 | background-color: #fff; 3 | -webkit-border-radius: 5px; 4 | border-radius: 5px; 5 | -webkit-box-shadow: 0 6px 32px 0 rgba(0,0,0,0.1); 6 | box-shadow: 0 6px 32px 0 rgba(0,0,0,0.1); 7 | overflow: hidden; 8 | } 9 | .stack-menu--active { 10 | display: block; 11 | } 12 | .stack-menu__list { 13 | margin: 0; 14 | padding: 0; 15 | list-style-type: none; 16 | display: none; 17 | } 18 | .stack-menu__list--active { 19 | display: block; 20 | } 21 | .stack-menu__item--hidden { 22 | display: none; 23 | } 24 | .stack-menu__link { 25 | padding-top: 14px; 26 | padding-left: 20px; 27 | padding-right: 20px; 28 | padding-bottom: 14px; 29 | display: block; 30 | text-decoration: none; 31 | position: relative; 32 | color: #000; 33 | -webkit-transition: color 0.25s ease-in-out, background-color 0.25s ease-in-out, background-image 0.25s ease-in-out; 34 | -moz-transition: color 0.25s ease-in-out, background-color 0.25s ease-in-out, background-image 0.25s ease-in-out; 35 | transition: color 0.25s ease-in-out, background-color 0.25s ease-in-out, background-image 0.25s ease-in-out; 36 | } 37 | .stack-menu__link--parent, 38 | .stack-menu__link--back { 39 | -webkit-background-size: 6px 12px; 40 | background-size: 6px 12px; 41 | background-repeat: no-repeat; 42 | } 43 | .stack-menu__link--parent { 44 | background-position: center right 20px; 45 | background-image: url("data:image/svg+xml,%3Csvg width='6' height='12' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23000' fill-rule='evenodd'%3E%3Cpath d='M.087 1.656L1.232.318l4.681 5.026-1.145 1.338z'/%3E%3Cpath d='M4.768 5.318l1.145 1.338-4.68 5.026-1.146-1.338z'/%3E%3C/g%3E%3C/svg%3E"); 46 | } 47 | .stack-menu__link--back { 48 | background-position: center left 20px; 49 | background-image: url("data:image/svg+xml,%3Csvg width='6' height='12' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23000' fill-rule='evenodd'%3E%3Cpath d='M5.913 1.656L4.768.318.087 5.344l1.145 1.338z'/%3E%3Cpath d='M1.232 5.318L.087 6.656l4.68 5.026 1.146-1.338z'/%3E%3C/g%3E%3C/svg%3E"); 50 | } 51 | .stack-menu__link--hidden { 52 | display: none; 53 | } 54 | .stack-menu__link:hover { 55 | color: #fff; 56 | background-color: #007aff; 57 | } 58 | .stack-menu__link--parent:hover { 59 | background-image: url("data:image/svg+xml,%3Csvg width='6' height='12' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23fff' fill-rule='evenodd'%3E%3Cpath d='M.087 1.656L1.232.318l4.681 5.026-1.145 1.338z'/%3E%3Cpath d='M4.768 5.318l1.145 1.338-4.68 5.026-1.146-1.338z'/%3E%3C/g%3E%3C/svg%3E"); 60 | } 61 | .stack-menu__link--back:hover { 62 | background-image: url("data:image/svg+xml,%3Csvg width='6' height='12' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23fff' fill-rule='evenodd'%3E%3Cpath d='M5.913 1.656L4.768.318.087 5.344l1.145 1.338z'/%3E%3Cpath d='M1.232 5.318L.087 6.656l4.68 5.026 1.146-1.338z'/%3E%3C/g%3E%3C/svg%3E"); 63 | } 64 | -------------------------------------------------------------------------------- /dist/jquery-stack-menu.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | var methods; 3 | methods = { 4 | init: function(element, options) { 5 | element.addClass('stack-menu'); 6 | element.find('ul').addClass('stack-menu__list'); 7 | element.find('ul:first').addClass('stack-menu__list--root').addClass('stack-menu__list--active'); 8 | element.find('li').addClass('stack-menu__item'); 9 | element.find('a').addClass('stack-menu__link'); 10 | $('.stack-menu__item').each(function(index) { 11 | $(this).attr('data-id', index); 12 | if ($(this).find('.stack-menu__list').length > 0) { 13 | $(this).children('.stack-menu__link').addClass('stack-menu__link--parent'); 14 | } 15 | }); 16 | $('.stack-menu__list').each(function() { 17 | var allItemElement, allLinkElement, backItemElement, backLinkElement, url; 18 | if (!$(this).hasClass('stack-menu__list--root')) { 19 | if (options.all) { 20 | url = $(this).closest('.stack-menu__item').find('.stack-menu__link').attr('href'); 21 | allItemElement = $('The plugin make simply navigation menu from unordered list
17 | 18 |