项目作者: SkipsoLabs

项目描述 :
Collapse navbar items dynamically, when there isn't enough space on the screen
高级语言: JavaScript
项目地址: git://github.com/SkipsoLabs/collapsible.git
创建时间: 2019-01-24T14:38:33Z
项目社区:https://github.com/SkipsoLabs/collapsible

开源协议:MIT License

下载





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 sensor@0.0.6/ResizeSensor.min.js">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:

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

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

  1. cd collapsible
  2. yarn

You’re ready to build the asset:

  1. yarn build

Usage

  1. <!-- .... -->
  2. <div class="navbar navbar-lg no-padding no-box-shadow navigation-bar">
  3. <ul class="nav navbar-nav nav-tabs nav-tabs-bottom bottom-divided no-margin">
  4. <li><a href="#startups">All Startups</a></li>
  5. <li><a href="#combinators">Combinators</a></li>
  6. <li><a href="#usa">USA</a></li>
  7. <li><a href="#europe">Europe</a></li>
  8. <li><a href="#asia">Asia</a></li>
  9. <li><a href="#challenges">Challenges</a></li>
  10. <li><a href="#designcontests">Design Contests</a></li>
  11. <li><a href="#devws">Dev Workshops</a></li>
  12. <li><a href="#businessws">Business Workshops</a></li>
  13. <li><a href="#marketingsessions">Marketing Sessions</a></li>
  14. <li><a href="#credits">Credits</a></li>
  15. </ul>
  16. </div>
  17. <!-- .... -->
  1. const collapsible = new Collapsible('.navbar-nav', 200);
  2. 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.