Coder Social home page Coder Social logo

bootstrap.push-menu's Introduction

bootstrap.push-menu

Enables push menu functionality with Bootstrap-compliant markup and CSS. Only takes effect at mobile resolution.

Check out the demo here

demo

Installation

You can use Bower to install bootstrap.push-menu:

$ bower install bootstrap.push-menu

Configuration

Add the CSS file:

<link rel="stylesheet" href="/bower_components/bootstrap.push-menu/dist/css/push-menu.css" />

and JS file:

<script src="/bower_components/bootstrap.push-menu/dist/js/push-menu.js"></script>

Then minimally add the data-toggle="push" and data-target attributes to your navbar-toggle button:

      <nav class="navbar navbar-default">
        <div class="container-fluid">
          <div class="navbar-header">
            <button type="button" class="navbar-toggle visible-xs" data-toggle="push" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">Project name</a>
          </div>
          <div id="navbar">
            <ul class="nav navbar-nav">
              <li class="active"><a href="#">Home</a></li>
              <li><a href="#">About</a></li>
              ...

For standard Bootstrap setups, data-toggle="push" replaces data-toggle="collapse" and data-target remains the same. You will also want to replace the collapsed class from the navbar-toggle button with visible-xs, as well as remove the navbar-collapse and collapse classes from the target #navbar, because we are essentially replacing the collapse functionality with push.

The javascript will automatically add a few classes to your navigation elements.

Options

These options can be placed on the button that toggles the push:

data-target is the selector for the navigation bar. Defaults to #navbar.

data-canvas is the selector for the element that will be pushed. This defaults to body and is almost always what you want.

data-direction is the direction that the canvas element and menu will slide. Defaults to left. Note: right does not work in standard Bootstrap navbar, as the navbar-toggle button will be on the right (and pushing it further right will place it off-screen).

bootstrap.push-menu's People

Contributors

developerdizzle avatar nurullah 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.