Giter Club home page Giter Club logo

ember-side-menu's Introduction

Ember-side-menu

Build Status Ember Observer Score npm version

Mobile friendly Ember menu component using CSS transitions. More effects and SVG path animations coming soon.

menu

Demo

Check out the live demo here

Ember Compability

This addon is compatible with and tested against Ember 1.13 and higher.

Installation

ember install ember-side-menu

Import ember-side-menu styles in your application's app.scss file.

@import "ember-side-menu";

Usage

Side Menu

{{#side-menu}} component is a main container of your menu. Place it on some top level of your DOM document for example in application.hbs file.

{{#side-menu}}
  <header class="navbar navbar-default">
    <div class="navbar-header">
    ...
    </div>
  </header>
  <ul class="nav">
    <li class="header">Events</li>
    <li>
      {{#side-menu-link-to "new"}}
        {{inline-svg "plus" class="icon"}}
        New Event
      {{/side-menu-link-to}}
    </li>
    <li class="divider"></li>
    ...
    <li>
      <a href="https://cowbell-labs.com/" target="_blank">
        {{inline-svg "cowbell" class="icon cowbell"}}
        Cowbell Labs
      </a>
    </li>
  </ul>
{{/side-menu}}
{{content-backdrop}}
<div class="page-content">
  {{partial "shared/navbar"}}

  <main>
    <div class="container">
      {{outlet}}
    </div>
  </main>

  {{outlet "footer"}}
</div>

Parameters

  • side - (string), which side of screen your menu takes. Possible values: ["left", "right"], default: "left"
  • width - (string), target width of open menu. CSS width - example values: ["40px", "40%", ...], default: null (default width set in CSS stylesheet to 70%)
  • initialTapAreaWidth - (integer, in px) - area width on left/right screen edge when menu swipe opening is initiated, default: 30
  • slightlyOpenWidth - (integer, in px) - width of slightly open menu. Menu is opened slightly on tap event within initialTapAreaWidth to the edge, default: 20
  • slightlyOpenAfter - (integer, in ms) - time delay after which menu is slighlty opened if it is still closed, default: 300

Content Backdrop

If you want to add backdrop to the rest of the layout while menu opening, then just place {{content-backdrop}} component after {{#side-menu}} component.

{{#side-menu}}
...
{{/side-menu}}
{{content-backdrop}}

Side Menu Toggle

Like a button component to toggle menu.

You can use default toggle button consist with some toggle bars

{{side-menu-toggle}}

You can use your own design block.

{{#side-menu-toggle}}
  <span class="glyphicon glyphicon-menu-hamburger"></span>
{{/side-menu-toggle}}

You can create a custom one by extending the main component.

import SideMenuToggle from "ember-side-menu/components/side-menu-toggle";

export default SideMenuToggle.extend({
    tagName: "button",
    classNames: ["navbar-btn", "btn", "btn-link", "pull-left"],
});

Parameters

  • side - (string), which side of screen your menu toggle takes. Possible values: ["left", "right"], default: "left"

Side Menu Link To

Works like a standard {{link-to}} helper, but also closes the menu.

{{#side-menu-link-to "new"}}
  New Event
{{/side-menu-link-to}

Side Menu Service

There is an available sideMenu service to control the menu.

export default Ember.Route.extend({
  sideMenu: Ember.inject.service(),

  actions: {
    openSideMenu() {
      this.get("sideMenu").open();
    },
  },
});

Methods

  • open
  • close
  • toggle

Properties

  • isOpen (boolean)
  • isClosed (boolean)
  • isSlightlyOpen (boolean)
  • progress (number) 0-100

License

MIT

ember-side-menu's People

Contributors

ember-tomster avatar kliput avatar tarrask avatar tsubik avatar

Watchers

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