GithubHelp home page GithubHelp logo

skipsolabs / collapsible Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 1.43 MB

Collapse navbar items dynamically, when there isn't enough space on the screen

License: MIT License

JavaScript 64.18% HTML 35.82%
collapsible bootstrap vanilla-js-plugin vanilla-js navbar menu a11y

collapsible's Introduction

Collapse navbar items dynamically, when there isn't enough space on the screen.


⚠️ This project is unmaintained ⚠️

Installation

It requires DOM4 to work on IE >= 10

It requires ResizeSensor to work correctly.

Using pre-generated asset

Copy the collapsible.js file, available in the dist folder, and include it in your HTML page.

Manually

You must have Node and npm installed on your system.

Clone this repository:

git clone https://github.com/domcorvasce/collapsible

Then, go into the folder and install the development dependencies:

cd collapsible
yarn

You're ready to build the asset:

yarn build

Usage

<!-- .... -->
<div class="navbar navbar-lg no-padding no-box-shadow navigation-bar">
    <ul class="nav navbar-nav nav-tabs nav-tabs-bottom bottom-divided no-margin">
        <li><a href="#startups">All Startups</a></li>
        <li><a href="#combinators">Combinators</a></li>
        <li><a href="#usa">USA</a></li>
        <li><a href="#europe">Europe</a></li>
        <li><a href="#asia">Asia</a></li>
        <li><a href="#challenges">Challenges</a></li>
        <li><a href="#designcontests">Design Contests</a></li>
        <li><a href="#devws">Dev Workshops</a></li>
        <li><a href="#businessws">Business Workshops</a></li>
        <li><a href="#marketingsessions">Marketing Sessions</a></li>
        <li><a href="#credits">Credits</a></li>
    </ul>
</div>
<!-- .... -->
const collapsible = new Collapsible('.navbar-nav', 200);
collapsible.render();

Constructor

  • selector: represents the container of the items to collapse
  • threshold: the minimum amount of available space before the collapse event is triggered

Methods

  • render: inject the collapsed menu and start looking for items to collapse

License

Released under MIT license.

collapsible's People

Contributors

dependabot[bot] avatar sav-valerio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

markxxv

collapsible's Issues

The ability to customize the HTML

Hi! Thanks for the great decision!
Q: are you considering adding the ability to change the HTML paste layout.
For example, I don't use bootstrap in a project, and would like to add an inscription instead of a sandwich. I'd like to change the hamburger to text.

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.