79 | [[index]], [[item.underlay]] at [[item.index]]
80 |
81 |
82 |
83 |
84 |
85 |
130 |
131 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](http://badge.fury.io/gh/motss%2Fpaper-swipe)
2 | [](http://badge.fury.io/bo/paper-swipe)
3 |
4 | # paper-swipe
5 |
6 | ## Update (1.0.0)
7 | Highlights of v1.0.0:
8 | - Added `fade` attribute for simple fade in/ fade out effect when swiping.
9 | - Removed `resetSwipe` attribute which is redundant and being taken care by new method `resetPosition()`.
10 | - Fixed layout issue on Safari Mobile.
11 | - Added custom mixins to style the element.
12 | - Prettier demo.
13 | - Code restructured.
14 |
15 | See the [component page](http://motss.github.io/paper-swipe/components/paper-swipe/) for more information.
16 |
17 | `paper-swipe` provides enables swipe gestures to swipe content to either the left or the right to unveil the underlay
18 | behind it.
19 |
20 | Example:
21 |
22 | By default, it can be swiped to either the left or the right.
23 | Swipe Gestures disabled
24 | Swipe with fade in/ fade out effect
25 | Only Left Swipe
26 | Only Right Swipe
27 | Tap Event Handler
28 | Panel is now at the edge of the screen
29 |
30 | `paper-swipe` allows user to use the custom DOM in the body to create basically any contents and it has two different
31 | sections which allows the customization by using the `content` and `underlay` attributes:
32 |
33 | Example:
34 |
35 |
36 |
Underlay content goes here...
37 |
Content of swiping element goes here...
38 |
39 |
40 | ## Event handling
41 |
42 | `paper-swipe` has been added some features to fire certain events such as `tap-underlay` and `edge` so that user can
43 | make use of it to perform additional functions as you like:
44 |
45 | Example:
46 |
47 | Underlay content goes here...
49 |
Fire `edge` event when the panel is at the edge of the screen...
50 |
51 |
52 |
53 |
Underlay content goes here...
54 |
Fire `tap-underlay` event when the panel is being clicked...
55 |
56 |
57 | There are two ways to disable the swiping on the content panel by using `on-tap-underlay` or `on-click` event handler:
58 |
59 | Example:
60 |
61 |
62 |
Click to reset the panel from the edge to its origin...
63 |
Swipe to remove the panel...
64 |
65 |
66 |
67 |
Click to reset the panel from the edge to its origin...
68 |
Swipe to remove the panel...
69 |
70 |
71 | ## Styling
72 | Note, it's important that specifying explicit height to the `paper-swipe` will render both the `content` and `underlay` layers to have the same height. Especially when multiple `paper-swipe` on the same document, explicit height will make all elements look consistent.
73 |
74 | paper-swipe {
75 | height: 100px;
76 | }
77 |
78 | paper-swipe {
79 | --paper-swipe: {
80 | height: 100px;
81 | };
82 | }
83 |
84 | The following custom properties and mixins are also available for styling:
85 |
86 | Custom mixin | Description | Default
87 | ----------------|-------------|----------
88 | `--paper-swipe` | `Mixin applied to paper-swipe` | `{}`
89 | `--paper-swipe-swipeable-container` | `Mixin applied to paper-swipe-swipeable-container` | `{}`
90 | `--paper-swipe-content` | `Mixin applied to swipeable content` | `{}`
91 | `--paper-swipe-underlay` | `Mixin applied to underlay beneath the swipeable content` | `{}`
92 |
93 | ## Demo + boilerplate generator
94 | [paper-swipe demo + boilerplate generator](http://motss.github.io/paper-swipe/components/paper-swipe/demo/index.html)
95 |
96 | ## Getting Started
97 |
98 | 1. Install with bower
99 | `bower install --save paper-swipe`
100 |
101 | 2. Load the web component and the dependencies
102 |
103 | ```html
104 |
105 |
106 |
107 | ```
108 |
109 | 3. Markup with <paper-swipe></paper-swipe>
110 |
111 | 4. Done
112 |
113 | ### Supported Browsers
114 |
115 | [Same as Polymer](http://www.polymer-project.org/resources/compatibility.html)
116 |
--------------------------------------------------------------------------------
/demo/boilerplate-generator.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
105 |
106 |
107 |
108 |
Element's Boilerplate
109 |
110 |
111 |
112 |
113 | disableSwipe
114 |
115 |
116 |
117 |
118 | fade //Note: Set true if fade in/ fade out while swiping towards/ away from the screen edge.
119 |
120 |
121 |
122 |
123 | swipeLeft
124 |
125 |
126 |
127 |
128 | swipeRight
129 |
130 |
131 |
132 |
133 | onEdge
134 |
135 |
136 |
137 |
138 | onTapUnderlay
139 |
140 |
141 |
142 |
143 |
144 | peekOffset //Optional: Number of pixels needed to slide in order to 'peek' the underlay's content.
145 |
146 |
147 |
148 |
149 | slideOffset //Optional: Number of pixels needed to slide to let the slider moves to the edge itself.
150 |
151 |
152 |
153 |
154 |
155 |
156 | content //Required: Add the attribute on an element as the sliding panel. For more info, please refer to the doc.
157 |
158 |
159 |
160 |
161 | underlay //Optional: Add the attribute on another element as the layer situated beneath the sliding panel. For more info, please refer to the doc.
162 |
163 |