Giter Site home page Giter Site logo

magnusmartin85 / off-canvas-menu Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 2.0 2.63 MB

Simple Off-Canvas-Menu

Home Page: http://off-canvas-menu.mgnmrt.com

License: GNU General Public License v3.0

HTML 17.51% SCSS 24.93% TypeScript 57.55%
menu navigation off-canvas canvas-menu vanilla-js javascript css webpack scss typescript

off-canvas-menu's Introduction

Off-Canvas Menu

Simple JavaScript Off-Canvas Menu.

Features

  • Simple
  • Mobile first
  • Multi level
  • Lightweight: ~6KB (generated js file)

Getting started

  1. Download the zip file of the latest release from GitHub. You will find a js and a css file inside.

  2. Include the css file at the top of your page in the head section: <link href="path/to/off-canvas-menu.css" rel="stylesheet" />

  3. Place the script tag at the bottom of your page right before the closing body tag: <script src="path/to/off-canvas-menu.js"></script>

  4. Create a navigation list for your off-canvas menu:

    <div class="off-canvas">
       <div class="off-canvas-header">
         <h4 class="off-canvas-title">Menu</h4>
         <div aria-label="Close">
           <div class="icon-close"></div>
         </div>
       </div>
    
       <div class="off-canvas-body">
         <nav class="off-canvas-nav">
           <div class="list-level-0">
             <div class="list-item">
               <a href="#" class="link-level-1"> Home </a>
             </div>
             <div class="list-item">
               <a href="#" class="link-level-1">
                 Services <span class="link-arrow">›</span>
               </a>
             </div>
             <div class="list-level-1">
               <div class="list-item">
                 <a href="#" class="link-level-2">
                   UX-Design <span class="link-arrow">›</span>
                 </a>
               </div>
               <div class="list-level-2">
                 <div class="list-item">
                   <a href="#" class="link-level-3"> Screendesign </a>
                 </div>
                 <div class="list-level-3"></div>
               </div>
               <div class="list-item">
                 <a href="#" class="link-level-2"> Webdesign </a>
               </div>
               <div class="list-item">
                 <a href="#" class="link-level-2"> Content Marketing </a>
               </div>
             </div>
             <div class="list-item">
               <a href="#" class="link-level-1">
                 Team <span class="link-arrow">›</span>
               </a>
             </div>
             <div class="list-level-1">
               <div class="list-item">
                 <a href="#" class="link-level-2"> John </a>
               </div>
               <div class="list-item">
                 <a href="#" class="link-level-2"> Peter </a>
               </div>
               <div class="list-item">
                 <a href="#" class="link-level-2"> Michael </a>
               </div>
             </div>
             <div class="list-item">
               <a href="#" class="link-level-1"> Contact </a>
             </div>
           </div>
         </nav>
       </div>
    </div>
    
  5. Create a menu toggle:

    <aside class="icon-open-row">
       <div class="icon-open-container">
         <div class="icon-open-col-1">☰</div>
         <div class="icon-open-col-2">Open Menu</div>
       </div>
    </aside>
    

Local development

Feel free to reach out for any kind of cooperation or feedback. PRs welcome.

Installation

For installation cd into the project root and run npm install.

Development

To serve on localhost run npm run start on the command line.

Build

For a production build run npm run build on the command line. This will generate a dist directory with index.html, off-canvas-menu.js and off-canvas-menu.css.

Demo

Demo

Built with

TypeScript is JavaScript with syntax for types.

CSS with superpowers.

Module Bundler for JavaScript.

Author

Magnus Martin

off-canvas-menu's People

Contributors

dependabot[bot] avatar magnusmartin85 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

rajpolu anon36

off-canvas-menu's Issues

Autclose demo

In Your demo - if i change to another top-level - the level before stays open. How to change that ?

Missing License declaration

Your menu works great now. Is there a way that You add a license(MIT - GPL - Apache ) please. In some countries no license means that all rights are kept.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.