Skip to content
This repository was archived by the owner on May 27, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
92ad160
Improvements
vitalyrotari Feb 19, 2015
6007fcb
Add toggleDrawer method
vitalyrotari Feb 19, 2015
40541b7
Fix drawerState update
vitalyrotari Feb 19, 2015
c228822
Cleanup code
vitalyrotari Feb 19, 2015
8f47a86
Add drawer overlay
vitalyrotari Feb 19, 2015
235d3e4
Add drawer-overlay styles
vitalyrotari Feb 19, 2015
fc231b8
Optimise drawer transition
vitalyrotari Feb 19, 2015
2c133c6
Fix drag when drawer is opened
vitalyrotari Feb 19, 2015
fb73dd6
HardwareBackButton support
vitalyrotari Feb 19, 2015
e6878e5
remove semi-colon from "drawer" directive
vitalyrotari Feb 19, 2015
55dd45a
Remove bracket from "isTarget" method
vitalyrotari Feb 19, 2015
abb17d8
Improve dragging
vitalyrotari Feb 19, 2015
34b485c
Fix demo
vitalyrotari Feb 20, 2015
c55039f
Drag improvements and debug mode
vitalyrotari Feb 20, 2015
9f64239
Fix stopImmediatePropagation
vitalyrotari Feb 20, 2015
f242bdb
Optimise "isClose" method
vitalyrotari Feb 20, 2015
12248c4
Add support for fast swipe
vitalyrotari Feb 20, 2015
fe9fd33
Cleanup code, remove console.log spams (use Developers Tools for debug)
vitalyrotari Feb 20, 2015
407479d
Remove debug attribute
vitalyrotari Feb 20, 2015
24814dd
Fix drawer overlay
vitalyrotari Feb 20, 2015
9d95d67
update drawer to work on right side
brybott May 1, 2015
007337d
updated README.md
brybott May 1, 2015
ad58e77
fixed closing from wrong side of screen
brybott May 2, 2015
91e154d
Slide content with menu on drag.
Aug 4, 2015
0ef1e97
Custom content directive (no more quirkiness from ionSideMenuContent)
Aug 5, 2015
3fe4965
Check if menu can be dragged (from $ionicSideMenuDelegate) before drag
Aug 5, 2015
b6bfd82
Allow overlay animation to run on drawer close
Aug 5, 2015
03afb8c
Compute content offset correctly when menu is on the left
Aug 5, 2015
5bba4ac
Handle box shadow better. Fix Android menu toggle performance.
Aug 5, 2015
05e85a2
Remove drag hotspot logic (allow drag to open from any point on screen)
Aug 10, 2015
1c388ca
Performance improvements
klizas Sep 8, 2015
88954d5
nativepagetransitions support tweaks
klizas Sep 8, 2015
f6ba2c4
Cleaned console.log
klizas Sep 9, 2015
ba5e769
Veikia tik dragginant 60px nuo kraštelio
klizas Sep 21, 2015
d6542a8
Timeout after menu item click
Oct 1, 2015
a824e21
Removed history reset after clicking menu item
Nov 15, 2015
e5775f4
Some changes
Feb 17, 2016
646c553
added package.json
Mar 6, 2016
2b21469
Added gruntfile to easily run demo code
Mar 30, 2016
d71a8b1
Control drawer from nav bar with $scope.drawerIsOpen()
Mar 30, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.*.sw*
node_modules
20 changes: 20 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = function(grunt) {

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
demo: {
options: {
open: true,
port: 8888,
keepalive: true,
base: '.'
}
}
}
});

grunt.loadNpmTasks('grunt-contrib-connect');
grunt.registerTask('default', 'connect');

};
56 changes: 56 additions & 0 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,59 @@ ionic-contrib-drawer
====================

A side menu drawer for Ionic apps

#####Setting up:

Clone the ionic-ion-drawer repo into the lib folder in your ionic project so it looks like:

*yourProjectName/www/lib/ionic-ion-drawer*

Add the ionic-contrib-drawer.js and ionic-contrib-drawer.css files to your index file

<link href="lib/ionic-ion-drawer/ionic.contrib.drawer.css" rel="stylesheet">
<script src="lib/ionic-ion-drawer/ionic.contrib.drawer.js"></script>

Add ionic.contrib.drawer to your Angular app:

angular.module('App', [
'ionic',
'ionic.contrib.drawer'
])

#####Usage:

Add the `<drawer>` directive to your ionic templates or index.html files.

#####Example:

<ion-view>
<ion-content>
<div class="bar bar-header bar-dark">
<h1 class="title">Example</h1>
</div>
</ion-content>
<drawer side="right">
<ion-content>
<h2>Menu</h2>
<button ng-click="closeDrawer()">Close</button>
<ion-list>
<ion-item>Friends</ion-item>
<ion-item>Favorites</ion-item>
<ion-item>Search</ion-item>
</ion-list>
</ion-content>
</drawer>
</ion-view>



Change the 'side' attribute of the `<drawer>` to either "right" or "left" to switch the side the drawer opens from.

#####Credits:

driftyco: https://github.com/driftyco (original build)

vitalyrotari: https://github.com/vitalyrotari (bug fixes, improved performance, background fading
transition)

brybott: https://github.com/brybott (right side functionality)
Empty file modified bower.json
100644 → 100755
Empty file.
27 changes: 27 additions & 0 deletions custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
drawer, drawer.left, drawer.right {
background-color: #222;
top: 44px;
width:20%;
}
.drawer-overlay {
top: 44px;
}
drawer h2 {
color: #fff;
margin-top: 40px !important;
margin-left: 15px;
font-weight: 200;
}

.item {
background: none;
color: #fff;
}

.item:first-child {
border-top: 0px;
}

.item:last-child {
border-bottom: 0px;
}
42 changes: 8 additions & 34 deletions index.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,18 @@
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Ionic Seed App</title>

<!-- ionic css -->
<!--<link href="http://code.ionicframework.com/1.0.0-beta.13/css/ionic.css" rel="stylesheet">-->
<link href="../ionic/dist/css/ionic.css" rel="stylesheet">
<link href="http://code.ionicframework.com/1.0.0-beta.14/css/ionic.css" rel="stylesheet">
<link rel="stylesheet" href="ionic.contrib.drawer.css">

<link rel="stylesheet" href="custom.css">
<!-- angularjs scripts -->
<script src="../ionic/dist/js/ionic.bundle.js"></script>

<script src="http://code.ionicframework.com/1.0.0-beta.14/js/ionic.bundle.js"></script>
<script src="ionic.contrib.drawer.js"></script>
<style>
drawer {
background-color: #222;
}
drawer h2 {
color: #fff;
margin-top: 40px !important;
margin-left: 15px;
font-weight: 200;
}
.item {
background: none;
color: #fff;
}
.item:first-child {
border-top: 0px;
}
.item:last-child {
border-bottom: 0px;
}
</style>
</head>

<!--
'starter' is the name of this angular module (js/app.js)
-->
</head>
<body ng-app="app">
<drawer side="left">
<ion-content>
<h2>Menu</h2>
<button ng-click="closeDrawer()">Close</button>
<ion-list>
<ion-item>Friends</ion-item>
<ion-item>Favorites</ion-item>
Expand All @@ -54,7 +25,10 @@ <h2>Menu</h2>
</drawer>
<ion-pane>
<ion-content>
<button ng-click="openDrawer()">Open</button>
<ion-header-bar class="bar-positive text-right">
<button class="drawer-button" ng-show="!drawerIsOpen()" ng-click="openDrawer()" ng-class="{'drawer-open': drawerIsOpen()}">Open</button>
<button class="drawer-button" ng-show="drawerIsOpen()" ng-click="closeDrawer()" ng-class="{'drawer-open': drawerIsOpen()}">Close</button>
</ion-header-bar>
</ion-content>
</ion-pane>
<script>
Expand Down
31 changes: 27 additions & 4 deletions ionic.contrib.drawer.css
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
drawer {
display: block;
position: fixed;
width: 270px;
height: 100%;
width: 90%;
z-index: 100;
background: #ffffff;
}

drawer.animate {
-webkit-transition: 0.4s all ease-in-out;
transition: 0.4s all ease-in-out;
drawer.animate, .menu-animated {
-webkit-transition: -webkit-transform 0.4s ease-in-out;
transition: transform 0.4s ease-in-out;
}

drawer.left {
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
box-shadow: 1px 0px 10px rgba(0,0,0,0.3);
}

drawer.right {
right: 0;
top: 0;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
box-shadow: -1px 0px 10px rgba(0,0,0,0.3);
}

drawer.closed {
box-shadow: none;
}

.drawer-overlay {
background-color: rgba(0, 0, 0, 0.6);
opacity: 0;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 99;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}

.drawer-overlay.animate {
-webkit-transition: 0.4s opacity ease-in-out;
transition: 0.4s opacity ease-in-out;
}
Loading