GithubHelp home page GithubHelp logo

sidebar_nav's Introduction

Live demo

About

You want a great nav panel that works across devices (desktop, iphone, android). The problem is that this is a hard problem and has a steep learning curve. This project makes getting something up and running fast extremely easy.

This project is based on the Massively demo project, which has a wonderful navigation system, but isolating just the nav part turns out to be a serious undertaking. This project extracts the navigation bar from massively and removes the dependencies and makes a dead simple API to use this sidebar nav panel.

API

  • The following Javascript functions are available:
    • sidebar_nav_init(title_str, html_str)
    • sidebar_nav_set(html_str)
    • sidebar_nav_error() returns true if there was an error.
    • sidebar_nav_hide() hides the navbar.

HTML setup

  • Your html document must include a div with the id as sidebar_nav_opacity_pane.
    • Example: <div id="sidebar_nav_opacity_pane">My test</div>
      • In this example the words "My test" will have a slick opacity effect applied. Clicking on this div while the sidebar navigation panel is in an open state, will close it. Other divs will NOT have their opacity changed nor will they act as click targets to dismiss an open nav panel.

Internals

  • Hidden dom elements are attached to the current html document.
    • div with id #__sidebar
    • div with id #__sidebarPanel
    • div with id #__sidebarFloatingPane
  • Additionally the <body> element will have the class is-sidebar-visible toggled depending on visibility of the navigation pane.

Test

  • Launch simple test server using python: python3 -m http.server
  • Or use the VSCode build tool run_server
    • Then open up http://localhost:8000 in a browser
      • Run test.

sidebar_nav's People

Contributors

zackees avatar

Watchers

 avatar

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.