Coder Social home page Coder Social logo

angular-sidebarjs's Introduction

Angular SidebarJS (AngularJS v1.x)

Create mobile sidebar/sidenav experiance in AngularJS.

Are you looking for a version with Angular? Try ng-sidebarjs

npm install angular-sidebarjs --save

Demo

Open the demo on your device and try the touch gestures!

Installation

Classic

<script src="your/path/angular-sidebarjs.js"></script>

Require

require('angular-sidebarjs');

ES6

import ngSidebarJS from 'angular-sidebarjs';

Options

<sidebarjs
  // Optional | Required only for multiple sidebarjs
  sidebarjs-name="mainSidebarJS"
  
  // Optional
  sidebarjs-config="{
      // Minimum swipe in px required to trigger listener: open
      documentMinSwipeX?: 10,
      // Range in px where document is listening for gesture: open
      documentSwipeRange?: 40,
      // Open and close sidebar with swipe gestures
      nativeSwipe?: true,
      // Enable/Disable open on swipe
      nativeSwipeOpen?: true,
      // Sidebar position, accepted values: left|right
      position?: 'left',
      // Backdrop opacity on sidebar open
      backdropOpacity?: 0.3,
  }"
  
  // Optional | Function called after sidebar is open
  on-close="$ctrl.onSidebarClose()"
  
  // Optional | Function called after sidebar is close
  on-open="$ctrl.onSidebarOpen()"
  
  // Optional | Function called when sidebar change visibility
  on-change-visibility="$ctrl.onSidebarChangeVisibility($event)">
</sidebarjs>

Implementation

Download files

Download and save all files

$ npm install angular-sidebarjs --save

Insert angular-sidebarjs.min.css and angular-sidebarjs.min.js in your index.html.

<head>

  <link rel="stylesheet" href="your/path/angular-sidebarjs.min.css">

</head>
<body>

  <script src="your/path/angular-sidebarjs.min.js"></script>

</body>

Inject ngSidebarJS

angular
  .module('DemoApp', [
    'ngSidebarJS'
  ])

Create SidebarJS element

Write sidebarjs tag and a trigger button with just [sidebarjs-toggle] attribute.

<body ng-app="DemoApp">

  <button sidebarjs-toggle>Open/Close</button>

  <sidebarjs>
    <div>Title</div>
    <nav>
      <a href="link">Home</a>
      <a href="link">About</a>
      <a href="link">Contacts</a>
    </nav>
  </sidebarjs>

</body>

angular-sidebarjs's People

Contributors

lorenzodianni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-sidebarjs's Issues

sidebar settings

Is there a way to disable sliding the menu when we try to drag from left side of the mobile screen?

Sidebar not closing on button click

I have given my code of sidebar directive below.

in my template:
<sidebarjs on-change-visibility="close_class == 'close'"> <div class="sidebar-head">Find User</div> <nav> <ul class="sidebar-menu"> <li ng-repeat="radius in radius"><a href="#" ui-sref="users({radius_id: $state.params.radius_id})" ui-sref-opts="{reload: true}">radius.name</a></li> </ul> </nav> </sidebarjs>

in my app.js:
var home = angular.module('wm.home',[uiRouter,'angular-carousel','ngSidebarJS'])

When I click on an option among the list, sidebar doesn't close and the required page loads behind. sidebar closes only when I click on the toggle button or outside the sidebar.. Anyone kindly help me to close the sidebar onclick of any of the options in the list.

it is posible to have the responsive option like pure js version?

Hello, my name is Germán,
I would like to know if it is posible to have the responsive option in angular-sidebarjs like sidebarjs (the pure js version)

// Show sidebar on screen > 1024px
responsive?: false

I really appreciate this!.. thank you very much!!!!

Two sidebars

Hi buddy,

I want two sidebars, one on the left and other in the right. Is it possible?

Thanks!

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.