* Wide Webkit Support (including Android WebKit 2.3.X)
* IE 10
* IE 9 Supports Toggling, Dragging but no Transitions
* IE 7/8 Supports Toggling but no dragging or Transitions
## Installation
As standalone just include the file in a script tag:
```html
<script src="snap.js"></script>
```
As a <ahref="http://component.io"target="_blank">web component</a> do:
```shell
$ component install jakiestfu/Snap.js
```
## Usage
```javascript
varsnapper=newSnap({
element:document.getElementById('content')
});
```
## Settings and Defaults
```javascript
settings={
element:null,
dragger:null,
disable:'none',
addBodyClasses:true,
hyperextensible:true,
resistance:0.5,
flickThreshold:50,
transitionSpeed:0.3,
easing:'ease',
maxPosition:266,
minPosition:-266,
tapToClose:true,
touchToDrag:true,
slideIntent:40,
minDragDistance:5
}
```
*`element`: The element which the user will be sliding side to side
*`dragger`: The element which the user will be using to slide the target element side to side
*`disable`: String, set to 'left' or 'right' to disable the respective side
*`addBodyClasses`: Add classes to the body to signify which side is being opened
*`hyperextensible`: If false, pane may not be slide past the minPosition and maxPosition
*`resistance`: The cooeficcient used to slow sliding when user has passed max or min threshold
*`flickThreshold`: Number of pixels the user needs to swiftly travel to activate a "flick" open
*`transitionSpeed`: The speed at which the pane slides open or closed
*`easing`: The CSS3 Easing method you want to use for transitions
*`maxPosition`: Maximum number of pixels the pane may be slid to the right
*`minPosition`: Maximum number of pixels the pane may be slid to the left
*`tapToClose`: If true, tapping an open pane will close it
*`touchToDrag`: If true, dragging the target `settings.element` will open/close the pane
*`minDragDistance`: The minimum amount of pixels the user needs to drag within the `slideIntent` degrees to move the pane
*`slideIntent`: The number of degrees the user must initiate sliding in towards the left or right (see diagram below)
Notes on Slide Intent: The slide intent is an int between 0 and 90, and represents the degrees in the first quadrant of a circle that you would like to have mirrored on the X *and* Y axis. For example, if you have 40 set as your `slideIntent` value, the user would only be able to slide the pane by dragging in the blue area in the diagram below. Once intent has been defined, it will not change until the user releases.
<imgsrc="http://i.imgur.com/uG2CNR8.png">
## Public Methods
### `open`: Opens the pane to the specified side
```javascript
snapper.open('left');
// OR
snapper.open('right');
```
### `close`: Closes the pane
```javascript
snapper.close();
```
### `expand`: Opens the pane entirely
```javascript
snapper.expand('left');
// OR
snapper.expand('right');
```
### `disable`: Disables sliding events
```javascript
snapper.disable();
```
### `enable`: Enables sliding events after disabling
```javascript
snapper.enable();
```
### `on`: Adds an event hook
```javascript
snapper.on('start',function(){
// Do Something
});
```
The available methods to hook into are as follows:
*`start`: Fired when touching down on the draggable pane and it begins to move
*`drag`: Fired when the pane has been moved or slid
*`end`: Fired when the pane has been let go of
*`animating`: Fired when the pane is animating
*`animated`: Fired when the pane is finished it's animations
*`ignore`: Fired when trying to drag the pane but ended up dragging on an ignored element
*`close`: Fired when close is called directly or if tapToClose is set to true
*`open`: Fired when the menu is opened
*`expandLeft`: Fired on expand('left')
*`expandRight`: Fired on expand('right')
*`enable`: Fired on enable
*`disable`: Fired on disable
### `off`: Removes an event hook
```javascript
snapper.off('drag');
```
The event names listed above apply for the `off` method.
### `settings`: Updates the settings for an already instantiated object
```javascript
snapper.settings({yourSettings});
```
Currently, `settings.element`, `settings.touchToDrag` cannot be updated. To update the element, instantiate a new object. To allow listening to a drag, use `snapper.enable()`
### `state`: Returns detailed information about the state of the pane
```javascript
vardata=snapper.state();
```
The data returned from the `state` method will look like the following:
```javascript
{
state:"closed",// State of the Pane
info:{
opening:"left",// Side which user intends to open
towards:"right",// Direction user is dragging towards
hyperExtending:false,// True if user is pulling past predefined bounds
halfway:false,// True if pane is at least halfway open
flick:false,// True if user has moved pane X amount of pixels in the open/close direction without changing directions
translation:{
absolute:20,// Pixels pane has translated
relative:21,// Pixels pane has translated relative to starting translation
sinceDirectionChange:10,// Pixels pane has translated since the direction of the pane has changed
percentage:40.571649// The percentage that the Pane is open. Good or animating other things
}
}
}
```
## Gotchas
### Layout
The layout itself is what most people will have a hard time emulating, so the simplest approach I have found is as follows:
Two absolute elements, one to represent *all* the content, and another to represent *all* the drawers. The content has a higher z-index than the drawers. Within the drawers element, it's direct children should represent the containers for the drawers, these should be `fixed` or `absolute`. Assigning classes to your drawers to specify which side it is on is recommended. All absolutely positioned elements should have 0 for `top, left, right, bottom` properties, excluding your panes which will have `auto` set to their respective sides and a width assigned. The width of your drawers is usually the same number you want to use for `minPosition` and `maxPosition`
```html
div.drawers {position: absolute;}
div.left-drawer {position: absolute;}
[content]
div.right-drawer {position: absolute;}
[content]
div#content {position: absolute;}
[top-bars]
[content] {overflow: auto}
[bottom-bars]
```
A sample layout is found in demo/apps/default.html.
### Independent Scrolling
Some CSS is required to get some smooth ass scrolling. Utilize the CSS below to apply this to any of your elements:
```css
.scrollable{
overflow:auto;
-webkit-transition-property:top,bottom;
transition-property:top,bottom;
-webkit-transition-duration:.2s,.2s;
transition-duration:.2s,.2s;
-webkit-transition-timing-function:linear,linear;
transition-timing-function:linear,linear;
-webkit-overflow-scrolling:touch;
}
```
### Z-Indeces and Display
Because of the nature of this code, drawers are just kind of stacked behind the content. To bring the proper drawer to the front, you can hook into Snaps.js' CSS classes:
With `addBodyClasses` set to `true` in your initialize options, one of the two classess will be added to the body tag: `.snapjs-left` or `.snapjs-right`, depending on which pane is being open, respectively. This being said, you can apply your CSS like the following to show the proper drawers:
```css
.snapjs-right.left-drawer,
.snapjs-left.right-drawer{
display:none;
}
```
## FAQ
### - How do I make a toggle button?
Toggles have been a popular request, but rather than bog the library down with additional methods, you can utilize the powerful API of Snap.js to create your own toggle. Toggles can be done like the following:
### - How do I disable Snap.js dragging for my touch slider?
Snap.js supports cascading cancellation of events via a data attribute `data-snap-ignore`. If you were to use a slider, your markup might look like the following:
```html
<divclass="slider"data-snap-ignore="true">
<ul>
<li><imgsrc="slide.jpg"></li>
<li><imgsrc="slide.jpg"></li>
<li><imgsrc="slide.jpg"></li>
<li><imgsrc="slide.jpg"></li>
<li><imgsrc="slide.jpg"></li>
</ul>
</div>
```
All interactions on children elements of the element with the `data-snap-ignore` attribute will have their Snap.js events ignored.
### - I am using Push.js from Ratchet, I keep losing my events on my elements, how can I fix this?
Simple. As wack as Push.js is (yes, it is in desperate need of attention as of v1.0.0), we can still solve this problem with it's only callback, `'push'`.
```javascript
// The function that will initialize your Snap.js instance
vardoSnap=function(){
if(window.snapper){
// Snap.js already exists, we just need to re-bind events
window.snapper.enable();
}else{
// Initialize Snap.js
window.snapper=newSnap({
element:document.getElementById('content')
});
}
};
window.addEventListener('push',doSnap);
doSnap();
```
### - Snap.js works on my Android device but i cannot scroll the content in my drawers, what gives?
Older Android devices (and iPhone as well) do not have native support for overflow scrolling. To solve this, you may use the wonderful library called [iScroll](https://github.com/cubiq/iscroll)
### - `transform: translate3d()` breaks my fixed child elements, how can I solve this?
[This is a problem with Chromium](https://code.google.com/p/chromium/issues/detail?id=20574) and should be fixed soon. I would advise not having your direct children element set to fixed, that may possibly solve your problem.
### - I am experiencing a weird flicker when the CSS transform is applied
To solve the flicker, apply the following CSS to the element in question
```css
#content{
backface-visibility:hidden;
-webkit-backface-visibility:hidden;/* Chrome and Safari */
-moz-backface-visibility:hidden;/* Firefox */
-ms-backface-visibility:hidden;/* Internet Explorer 10+ */
}
```
## Compliments
This code attempts to make your webapp's feel more "native". These other repos go well with it, too!
<!DOCTYPE HTML><htmllang="en-US"><head><title>Snap.js</title><metahttp-equiv="x-ua-compatible"content="IE=edge"/><metaname="viewport"content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"><metaname="apple-mobile-web-app-capable"content="yes"><metaname="apple-touch-fullscreen"content="yes"><linkrel="stylesheet"type="text/css"href="../../snap.css"/><linkrel="stylesheet"type="text/css"href="../assets/demo.css"/></head><body><divclass="snap-drawers"><divclass="snap-drawer snap-drawer-left"><div><h3>Snap.js</h3><divclass="demo-social"><ahref="https://twitter.com/share"class="twitter-share-button"data-lang="en"data-text="Snap.js - A Library for creating beautiful mobile shelfs in Javascript"data-url="http://jakiestfu.github.com/Snap.js/"data-count="none"data-via="jakiestfu">Tweet</a><ahref="https://twitter.com/jakiestfu"class="twitter-follow-button"data-show-count="false"data-lang="en">Follow @jakiestfu</a><iframesrc="http://ghbtns.com/github-btn.html?user=jakiestfu&repo=Snap.js&type=watch&count=true"allowtransparency="true"frameborder="0"scrolling="0"width="120"height="20"></iframe></div><h4>Demos</h4><ul><li><ahref="default.html">Default</a></li><li><ahref="noDrag.html">No Drag</a></li><li><ahref="dragElement.html">Drag Element</a></li><li><ahref="rightDisabled.html">Right Disabled</a></li><li><ahref="hyperextend.html">Hyperextension Disabled</a></li><li><ahref="skinnyThreshold.html">Skinny Threshold</a></li><li><ahref="toggles.html">Toggles</a></li><li><ahref="classNames.html">Class Names</a></li><li><ahref="expand.html">Expanding</a></li><li><ahref="settings.html">Settings</a></li><li><ahref="ratchet/template.html">Ratchet</a></li></ul><div><p>The class names demo shows how you can utilize the classess added by Snap.js to adjust hidden content. In this case, we're showing the same menu on both sides of the app via CSS and classess.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non erat ac leo ultrices blandit sed vel risus. Pellentesque facilisis blandit auctor. Maecenas vestibulum vulputate tincidunt. Mauris nec quam libero. Fusce eget ligula non leo varius condimentum quis ac elit. Donec id urna ut neque semper ultrices. Proin ut suscipit felis. Nullam neque felis, ullamcorper scelerisque volutpat vel, vehicula vehicula neque. Aenean scelerisque elit ac erat sagittis ullamcorper.</p></div></div></div><divclass="snap-drawer snap-drawer-right"></div></div><divid="content"class="snap-content"style="opacity:0.8;"><divid="toolbar"><ahref="#"id="open-left"></a><h1>Class Names</h1></div></div><script type="text/javascript"src="../../snap.js"></script><script type="text/javascript">varsnapper=newSnap({element:document.getElementById('content')});</script><script type="text/javascript"src="../assets/demo.js"></script><script>!function(d,s,id){varjs,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></body></html>
<!DOCTYPE HTML><htmllang="en-US"><head><title>Snap.js</title><metahttp-equiv="x-ua-compatible"content="IE=edge"/><metaname="viewport"content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"><metaname="apple-mobile-web-app-capable"content="yes"><metaname="apple-touch-fullscreen"content="yes"><linkrel="stylesheet"type="text/css"href="../../snap.css"/><linkrel="stylesheet"type="text/css"href="../assets/demo.css"/></head><body><divclass="snap-drawers"><divclass="snap-drawer snap-drawer-left"><div><h3>Snap.js</h3><divclass="demo-social"><ahref="https://twitter.com/share"class="twitter-share-button"data-lang="en"data-text="Snap.js - A Library for creating beautiful mobile shelfs in Javascript"data-url="http://jakiestfu.github.com/Snap.js/"data-count="none"data-via="jakiestfu">Tweet</a><ahref="https://twitter.com/jakiestfu"class="twitter-follow-button"data-show-count="false"data-lang="en">Follow @jakiestfu</a><iframesrc="http://ghbtns.com/github-btn.html?user=jakiestfu&repo=Snap.js&type=watch&count=true"allowtransparency="true"frameborder="0"scrolling="0"width="120"height="20"></iframe></div><h4>Demos</h4><ul><li><ahref="default.html">Default</a></li><li><ahref="noDrag.html">No Drag</a></li><li><ahref="dragElement.html">Drag Element</a></li><li><ahref="rightDisabled.html">Right Disabled</a></li><li><ahref="hyperextend.html">Hyperextension Disabled</a></li><li><ahref="skinnyThreshold.html">Skinny Threshold</a></li><li><ahref="toggles.html">Toggles</a></li><li><ahref="classNames.html">Class Names</a></li><li><ahref="expand.html">Expanding</a></li><li><ahref="settings.html">Settings</a></li><li><ahref="ratchet/template.html">Ratchet</a></li></ul><div><p>The Default demo shows basic Snap.js functionality</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non erat ac leo ultrices blandit sed vel risus. Pellentesque facilisis blandit auctor. Maecenas vestibulum vulputate tincidunt. Mauris nec quam libero. Fusce eget ligula non leo varius condimentum quis ac elit. Donec id urna ut neque semper ultrices. Proin ut suscipit felis. Nullam neque felis, ullamcorper scelerisque volutpat vel, vehicula vehicula neque. Aenean scelerisque elit ac erat sagittis ullamcorper.</p></div></div></div><divclass="snap-drawer snap-drawer-right"></div></div><divid="content"class="snap-content"><divid="toolbar"><ahref="#"id="open-left"></a><h1>Default</h1></div></div><script type="text/javascript"src="../../snap.js"></script><script type="text/javascript">varsnapper=newSnap({element:document.getElementById('content')});</script><script type="text/javascript"src="../assets/demo.js"></script><script>!function(d,s,id){varjs,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></body></html>
<ahref="https://twitter.com/share"class="twitter-share-button"data-lang="en"data-text="Snap.js - A Library for creating beautiful mobile shelfs in Javascript"data-url="http://jakiestfu.github.com/Snap.js/"data-count="none"data-via="jakiestfu">Tweet</a>
<p>Data attributes can be used to define elements that you want to have prevent sliding of a pane (maybe a photo slider, etc)</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non erat ac leo ultrices blandit sed vel risus. Pellentesque facilisis blandit auctor. Maecenas vestibulum vulputate tincidunt. Mauris nec quam libero. Fusce eget ligula non leo varius condimentum quis ac elit. Donec id urna ut neque semper ultrices. Proin ut suscipit felis. Nullam neque felis, ullamcorper scelerisque volutpat vel, vehicula vehicula neque. Aenean scelerisque elit ac erat sagittis ullamcorper.</p>
<inputtype="text"id="search"placeholder="Search for Things">
</div>
<divclass="drawer-inner">
<h3>Snap.js</h3>
<divclass="demo-social">
<ahref="https://twitter.com/share"class="twitter-share-button"data-lang="en"data-text="Snap.js - A Library for creating beautiful mobile shelfs in Javascript"data-url="http://jakiestfu.github.com/Snap.js/"data-count="none"data-via="jakiestfu">Tweet</a>
<p>Expanding is when the app disappears completely and the entire app's drawer takes up the usable space. Good for searching</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non erat ac leo ultrices blandit sed vel risus. Pellentesque facilisis blandit auctor. Maecenas vestibulum vulputate tincidunt. Mauris nec quam libero. Fusce eget ligula non leo varius condimentum quis ac elit. Donec id urna ut neque semper ultrices. Proin ut suscipit felis. Nullam neque felis, ullamcorper scelerisque volutpat vel, vehicula vehicula neque. Aenean scelerisque elit ac erat sagittis ullamcorper.</p>
<!DOCTYPE HTML><htmllang="en-US"><head><title>Snap.js</title><metahttp-equiv="x-ua-compatible"content="IE=edge"/><metaname="viewport"content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"><metaname="apple-mobile-web-app-capable"content="yes"><metaname="apple-touch-fullscreen"content="yes"><linkrel="stylesheet"type="text/css"href="../../snap.css"/><linkrel="stylesheet"type="text/css"href="../assets/demo.css"/></head><body><divclass="snap-drawers"><divclass="snap-drawer snap-drawer-left"><div><h3>Snap.js</h3><divclass="demo-social"><ahref="https://twitter.com/share"class="twitter-share-button"data-lang="en"data-text="Snap.js - A Library for creating beautiful mobile shelfs in Javascript"data-url="http://jakiestfu.github.com/Snap.js/"data-count="none"data-via="jakiestfu">Tweet</a><ahref="https://twitter.com/jakiestfu"class="twitter-follow-button"data-show-count="false"data-lang="en">Follow @jakiestfu</a><iframesrc="http://ghbtns.com/github-btn.html?user=jakiestfu&repo=Snap.js&type=watch&count=true"allowtransparency="true"frameborder="0"scrolling="0"width="120"height="20"></iframe></div><h4>Demos</h4><ul><li><ahref="default.html">Default</a></li><li><ahref="noDrag.html">No Drag</a></li><li><ahref="dragElement.html">Drag Element</a></li><li><ahref="rightDisabled.html">Right Disabled</a></li><li><ahref="hyperextend.html">Hyperextension Disabled</a></li><li><ahref="skinnyThreshold.html">Skinny Threshold</a></li><li><ahref="toggles.html">Toggles</a></li><li><ahref="classNames.html">Class Names</a></li><li><ahref="expand.html">Expanding</a></li><li><ahref="settings.html">Settings</a></li><li><ahref="ratchet/template.html">Ratchet</a></li></ul><div><p>The Default demo shows basic Snap.js functionality</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non erat ac leo ultrices blandit sed vel risus. Pellentesque facilisis blandit auctor. Maecenas vestibulum vulputate tincidunt. Mauris nec quam libero. Fusce eget ligula non leo varius condimentum quis ac elit. Donec id urna ut neque semper ultrices. Proin ut suscipit felis. Nullam neque felis, ullamcorper scelerisque volutpat vel, vehicula vehicula neque. Aenean scelerisque elit ac erat sagittis ullamcorper.</p></div></div></div><divclass="snap-drawer snap-drawer-right"></div></div><divid="content"class="snap-content"><divid="toolbar"><ahref="#"id="open-left"></a><h1>No Hyperextension</h1></div></div><script type="text/javascript"src="../../snap.js"></script><script type="text/javascript">varsnapper=newSnap({element:document.getElementById('content'),hyperextensible:false});</script><script type="text/javascript"src="../assets/demo.js"></script><script>!function(d,s,id){varjs,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></body></html>
<ahref="https://twitter.com/share"class="twitter-share-button"data-lang="en"data-text="Snap.js - A Library for creating beautiful mobile shelfs in Javascript"data-url="http://jakiestfu.github.com/Snap.js/"data-count="none"data-via="jakiestfu">Tweet</a>
<p>Data attributes can be used to define elements that you want to have prevent sliding of a pane (maybe a photo slider, etc)</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non erat ac leo ultrices blandit sed vel risus. Pellentesque facilisis blandit auctor. Maecenas vestibulum vulputate tincidunt. Mauris nec quam libero. Fusce eget ligula non leo varius condimentum quis ac elit. Donec id urna ut neque semper ultrices. Proin ut suscipit felis. Nullam neque felis, ullamcorper scelerisque volutpat vel, vehicula vehicula neque. Aenean scelerisque elit ac erat sagittis ullamcorper.</p>
/* Hacky way to right align buttons outside of flex-box system
Note: is only absolutely positioned button, would be better if flex-box had an "align right" option */
.bar-title.title+[class*="button"]:last-child,
.bar-title.button+[class*="button"]:last-child,
.bar-title[class*="button"].pull-right{
position:absolute;
top:5px;
right:5px;
}
/* Override standard button active states */
.bar-title.button:active{
color:#fff;
background-color:#0876b1;
}
/* Directional buttons in title bars (thanks to @GregorAdams for solution - http://cssnerd.com/2011/11/30/the-best-pure-css3-ios-style-arrow-back-button/)
<!-- Wrap all non-bar HTML in the .content div (this is actually what scrolls) -->
<divclass="content">
<divclass="content-padded">
<pclass="welcome">Thanks for downloading Ratchet. This is an example HTML page that's linked up to compiled Ratchet CSS and JS, has the proper meta tags and the HTML structure. Need some more help before you start filling this with your own content? Check out some Ratchet resorces:</p>
<!DOCTYPE HTML><htmllang="en-US"><head><title>Snap.js</title><metahttp-equiv="x-ua-compatible"content="IE=edge"/><metaname="viewport"content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"><metaname="apple-mobile-web-app-capable"content="yes"><metaname="apple-touch-fullscreen"content="yes"><linkrel="stylesheet"type="text/css"href="../../snap.css"/><linkrel="stylesheet"type="text/css"href="../assets/demo.css"/></head><body><divclass="snap-drawers"><divclass="snap-drawer snap-drawer-left"><div><h3>Snap.js</h3><divclass="demo-social"><ahref="https://twitter.com/share"class="twitter-share-button"data-lang="en"data-text="Snap.js - A Library for creating beautiful mobile shelfs in Javascript"data-url="http://jakiestfu.github.com/Snap.js/"data-count="none"data-via="jakiestfu">Tweet</a><ahref="https://twitter.com/jakiestfu"class="twitter-follow-button"data-show-count="false"data-lang="en">Follow @jakiestfu</a><iframesrc="http://ghbtns.com/github-btn.html?user=jakiestfu&repo=Snap.js&type=watch&count=true"allowtransparency="true"frameborder="0"scrolling="0"width="120"height="20"></iframe></div><h4>Demos</h4><ul><li><ahref="default.html">Default</a></li><li><ahref="noDrag.html">No Drag</a></li><li><ahref="dragElement.html">Drag Element</a></li><li><ahref="rightDisabled.html">Right Disabled</a></li><li><ahref="hyperextend.html">Hyperextension Disabled</a></li><li><ahref="skinnyThreshold.html">Skinny Threshold</a></li><li><ahref="toggles.html">Toggles</a></li><li><ahref="classNames.html">Class Names</a></li><li><ahref="expand.html">Expanding</a></li><li><ahref="settings.html">Settings</a></li><li><ahref="ratchet/template.html">Ratchet</a></li></ul><div><p>This demo has the menu on the right side disabled</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non erat ac leo ultrices blandit sed vel risus. Pellentesque facilisis blandit auctor. Maecenas vestibulum vulputate tincidunt. Mauris nec quam libero. Fusce eget ligula non leo varius condimentum quis ac elit. Donec id urna ut neque semper ultrices. Proin ut suscipit felis. Nullam neque felis, ullamcorper scelerisque volutpat vel, vehicula vehicula neque. Aenean scelerisque elit ac erat sagittis ullamcorper.</p></div></div></div><divclass="snap-drawer snap-drawer-right"></div></div><divid="content"class="snap-content"><divid="toolbar"><ahref="#"id="open-left"></a><h1>Right Disabled</h1></div></div><script type="text/javascript"src="../../snap.js"></script><script type="text/javascript">varsnapper=newSnap({element:document.getElementById('content'),disable:'right'});</script><script type="text/javascript"src="../assets/demo.js"></script><script>!function(d,s,id){varjs,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></body></html>
<!DOCTYPE HTML><htmllang="en-US"><head><title>Snap.js</title><metahttp-equiv="x-ua-compatible"content="IE=edge"/><metaname="viewport"content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"><metaname="apple-mobile-web-app-capable"content="yes"><metaname="apple-touch-fullscreen"content="yes"><linkrel="stylesheet"type="text/css"href="../../snap.css"/><linkrel="stylesheet"type="text/css"href="../assets/demo.css"/></head><body><divclass="snap-drawers"><divclass="snap-drawer snap-drawer-left"><div><h3>Snap.js</h3><divclass="demo-social"><ahref="https://twitter.com/share"class="twitter-share-button"data-lang="en"data-text="Snap.js - A Library for creating beautiful mobile shelfs in Javascript"data-url="http://jakiestfu.github.com/Snap.js/"data-count="none"data-via="jakiestfu">Tweet</a><ahref="https://twitter.com/jakiestfu"class="twitter-follow-button"data-show-count="false"data-lang="en">Follow @jakiestfu</a><iframesrc="http://ghbtns.com/github-btn.html?user=jakiestfu&repo=Snap.js&type=watch&count=true"allowtransparency="true"frameborder="0"scrolling="0"width="120"height="20"></iframe></div><h4>Demos</h4><ul><li><ahref="default.html">Default</a></li><li><ahref="noDrag.html">No Drag</a></li><li><ahref="dragElement.html">Drag Element</a></li><li><ahref="rightDisabled.html">Right Disabled</a></li><li><ahref="hyperextend.html">Hyperextension Disabled</a></li><li><ahref="skinnyThreshold.html">Skinny Threshold</a></li><li><ahref="toggles.html">Toggles</a></li><li><ahref="classNames.html">Class Names</a></li><li><ahref="expand.html">Expanding</a></li><li><ahref="settings.html">Settings</a></li><li><ahref="ratchet/template.html">Ratchet</a></li></ul><div><p>You can update the settings of an instantiated snap object by calling the settings method.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non erat ac leo ultrices blandit sed vel risus. Pellentesque facilisis blandit auctor. Maecenas vestibulum vulputate tincidunt. Mauris nec quam libero. Fusce eget ligula non leo varius condimentum quis ac elit. Donec id urna ut neque semper ultrices. Proin ut suscipit felis. Nullam neque felis, ullamcorper scelerisque volutpat vel, vehicula vehicula neque. Aenean scelerisque elit ac erat sagittis ullamcorper.</p></div></div></div><divclass="snap-drawer snap-drawer-right"></div></div><divid="content"class="snap-content"><divid="toolbar"><ahref="#"id="open-left"></a><h1>Updatable Settings</h1></div><divstyle="padding-top: 50px"><divclass="opt"><p>Change Speed: </p><selectdata-key="speed"><optionvalue="0.3">Normal</option><optionvalue="1">Slow</option><optionvalue="0.2">Fast</option></select></div><divclass="opt"><p>Change Easing</p><selectdata-key="easing"><optionvalue="ease">ease</option><optionvalue="linear">linear</option><optionvalue="cubic-bezier(0.175, 0.885, 0.320, 1.275)">easeOutBack (Bezier Curve)</option></select></div><divclass="opt"><p>Disable</p><selectdata-key="disable"><optionvalue="none">None</option><optionvalue="left">Left</option><optionvalue="right">Right</option></select></div><divclass="opt"><p>And More!</p></div></div></div><script type="text/javascript"src="../../snap.js"></script><script type="text/javascript">varsnapper=newSnap({element:document.getElementById('content')}),updateSnap=function(){varkey=this.dataset.key,val=this.value,opts={};switch(key){case'speed':opts.transitionSpeed=parseFloat(val,10);break;case'easing':opts.easing=val;break;case'disable':opts.disable=val;break;}snapper.settings(opts);},selects=document.getElementsByTagName('select'),i;for(i=0;i<selects.length;i++){selects[i].addEventListener('change',updateSnap);}</script><script type="text/javascript"src="../assets/demo.js"></script><script>!function(d,s,id){varjs,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></body></html>
<!DOCTYPE HTML><htmllang="en-US"><head><title>Snap.js</title><metahttp-equiv="x-ua-compatible"content="IE=edge"/><metaname="viewport"content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"><metaname="apple-mobile-web-app-capable"content="yes"><metaname="apple-touch-fullscreen"content="yes"><linkrel="stylesheet"type="text/css"href="../../snap.css"/><linkrel="stylesheet"type="text/css"href="../assets/demo.css"/></head><body><divclass="snap-drawers"><divclass="snap-drawer snap-drawer-left"><div><h3>Snap.js</h3><divclass="demo-social"><ahref="https://twitter.com/share"class="twitter-share-button"data-lang="en"data-text="Snap.js - A Library for creating beautiful mobile shelfs in Javascript"data-url="http://jakiestfu.github.com/Snap.js/"data-count="none"data-via="jakiestfu">Tweet</a><ahref="https://twitter.com/jakiestfu"class="twitter-follow-button"data-show-count="false"data-lang="en">Follow @jakiestfu</a><iframesrc="http://ghbtns.com/github-btn.html?user=jakiestfu&repo=Snap.js&type=watch&count=true"allowtransparency="true"frameborder="0"scrolling="0"width="120"height="20"></iframe></div><h4>Demos</h4><ul><li><ahref="default.html">Default</a></li><li><ahref="noDrag.html">No Drag</a></li><li><ahref="dragElement.html">Drag Element</a></li><li><ahref="rightDisabled.html">Right Disabled</a></li><li><ahref="hyperextend.html">Hyperextension Disabled</a></li><li><ahref="skinnyThreshold.html">Skinny Threshold</a></li><li><ahref="toggles.html">Toggles</a></li><li><ahref="classNames.html">Class Names</a></li><li><ahref="expand.html">Expanding</a></li><li><ahref="settings.html">Settings</a></li><li><ahref="ratchet/template.html">Ratchet</a></li></ul><div><p>You can define the width of your app's sliding space</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non erat ac leo ultrices blandit sed vel risus. Pellentesque facilisis blandit auctor. Maecenas vestibulum vulputate tincidunt. Mauris nec quam libero. Fusce eget ligula non leo varius condimentum quis ac elit. Donec id urna ut neque semper ultrices. Proin ut suscipit felis. Nullam neque felis, ullamcorper scelerisque volutpat vel, vehicula vehicula neque. Aenean scelerisque elit ac erat sagittis ullamcorper.</p></div></div></div><divclass="snap-drawer snap-drawer-right"></div></div><divid="content"class="snap-content"><divid="toolbar"><ahref="#"id="open-left"></a><h1>Skinny Threshold</h1></div></div><script type="text/javascript"src="../../snap.js"></script><script type="text/javascript">varsnapper=newSnap({element:document.getElementById('content'),maxPosition:100,minPosition:-100});</script><script type="text/javascript"src="../assets/demo.js"></script><script>!function(d,s,id){varjs,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></body></html>
<!DOCTYPE HTML><htmllang="en-US"><head><title>Snap.js</title><metahttp-equiv="x-ua-compatible"content="IE=edge"/><metaname="viewport"content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"><metaname="apple-mobile-web-app-capable"content="yes"><metaname="apple-touch-fullscreen"content="yes"><linkrel="stylesheet"type="text/css"href="../../snap.css"/><linkrel="stylesheet"type="text/css"href="../assets/demo.css"/></head><body><divclass="snap-drawers"><divclass="snap-drawer snap-drawer-left"><div><h3>Snap.js</h3><divclass="demo-social"><ahref="https://twitter.com/share"class="twitter-share-button"data-lang="en"data-text="Snap.js - A Library for creating beautiful mobile shelfs in Javascript"data-url="http://jakiestfu.github.com/Snap.js/"data-count="none"data-via="jakiestfu">Tweet</a><ahref="https://twitter.com/jakiestfu"class="twitter-follow-button"data-show-count="false"data-lang="en">Follow @jakiestfu</a><iframesrc="http://ghbtns.com/github-btn.html?user=jakiestfu&repo=Snap.js&type=watch&count=true"allowtransparency="true"frameborder="0"scrolling="0"width="120"height="20"></iframe></div><h4>Demos</h4><ul><li><ahref="default.html">Default</a></li><li><ahref="noDrag.html">No Drag</a></li><li><ahref="dragElement.html">Drag Element</a></li><li><ahref="rightDisabled.html">Right Disabled</a></li><li><ahref="hyperextend.html">Hyperextension Disabled</a></li><li><ahref="skinnyThreshold.html">Skinny Threshold</a></li><li><ahref="toggles.html">Toggles</a></li><li><ahref="classNames.html">Class Names</a></li><li><ahref="expand.html">Expanding</a></li><li><ahref="settings.html">Settings</a></li><li><ahref="ratchet/template.html">Ratchet</a></li></ul><div><p>Toggles are easy to create. Snap.js gives you the state of the pane and allows you to make decisions simply.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non erat ac leo ultrices blandit sed vel risus. Pellentesque facilisis blandit auctor. Maecenas vestibulum vulputate tincidunt. Mauris nec quam libero. Fusce eget ligula non leo varius condimentum quis ac elit. Donec id urna ut neque semper ultrices. Proin ut suscipit felis. Nullam neque felis, ullamcorper scelerisque volutpat vel, vehicula vehicula neque. Aenean scelerisque elit ac erat sagittis ullamcorper.</p></div></div></div><divclass="snap-drawer snap-drawer-right"></div></div><divid="content"class="snap-content"><divid="toolbar"><ahref="#"id="open-left"></a><h1>Toggles</h1></div><divclass="toggler"id="ol">Open Left</div><divclass="toggler"id="or">Open Right</div></div><script type="text/javascript"src="../../snap.js"></script><script type="text/javascript"src="../assets/demo.js"></script><script type="text/javascript">varsnapper=newSnap({element:document.getElementById('content')});addEvent(document.getElementById('ol'),'click',function(){snapper.open('left');});addEvent(document.getElementById('or'),'click',function(){snapper.open('right');});</script><script>!function(d,s,id){varjs,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></body></html>
/* Show "Left" drawer for the "Right" drawer in the demo */.snapjs-right.snap-drawer-left{display:block;right:0;left:auto;}/* Hide the actual "Right" drawer in the demo */.snapjs-right.snap-drawer-right{display:none;}/* Show the "Drag" background in the demo */#content{background:#BFC7D8url(drag.png)center75%no-repeat;}/* Demo toolbar styles */#toolbar{background:#536ea7;border-bottom:1pxsolid#111b32;position:absolute;top:0;right:0;left:0;width:auto;height:44px;}#toolbarh1{color:#fff;font-size:16px;line-height:22px;text-align:center;text-shadow:0-1px0rgba(0,0,0,0.8);position:absolute;top:0;right:44px;left:44px;width:auto;height:44px;}#open-left{background:url(open.png)centercenterno-repeat;display:block;width:44px;height:44px;}/* Show the red "No Drag" box in the demo */#no-drag,#do-drag{position:absolute;top:50%;left:50%;width:50%;height:100px;margin-left:-25%;margin-top:-50px;background:red;color:#FFF;text-align:center;line-height:100px;}#do-drag{background:green;}/* Styles for the social buttons in the demo */.demo-social{padding:015px;}/* Show the translucent white "Toggle" boxes in the demo */.toggler{width:80%;background:rgba(255,255,255,0.5);margin:0auto;position:relative;top:70px;padding:20px;margin-bottom:20px;text-align:center;}/* Styles for expanding "Search" input in the "Expanding" demo */.search{padding-bottom:10px;border-bottom:1pxsolidrgba(0,0,0,0.2);-webkit-box-shadow:01px0rgba(255,255,255,0.1);-moz-box-shadow:01px0rgba(255,255,255,0.1);box-shadow:01px0rgba(255,255,255,0.1);}#search{height:30px;width:87%;margin:7px7px07px;background:linear-gradient(#414A5A,#4C5464);background:-webkit-linear-gradient(#414A5A,#4C5464);padding-left:15px;border:1pxsolid#222936;-webkit-border-radius:25px;-moz-border-radius:25px;border-radius:25px;-webkit-box-shadow:inset01px2px-1pxrgba(0,0,0,0.5),01px2px-1pxrgba(255,255,255,0.4);-moz-box-shadow:inset01px2px-1pxrgba(0,0,0,0.5),01px2px-1pxrgba(255,255,255,0.4);box-shadow:inset01px2px-1pxrgba(0,0,0,0.5),01px2px-1pxrgba(255,255,255,0.4);}#search:focus{outline:none;border-color:#151515;}/* Styles for fading out the drawer content in the "Expanding" demo */.drawer-inner{-webkit-transition:opacity0.3sease;-moz-transition:opacity0.3sease;-ms-transition:opacity0.3sease;-o-transition:opacity0.3sease;transition:opacity0.3sease;}.snapjs-expand-left.drawer-inner,.snapjs-expand-right.drawer-inner{opacity:0;}/* Styles for the "Settings" demo */.opt{padding:20px;border-bottom:1pxsolidrgba(0,0,0,0.1);}.optp{font-weight:bold;margin-top:0;margin-bottom:5px;color:#222;color:rgba(0,0,0,0.6);}/* Default demo styles */.snap-content{background:#BFC7D8;}.snap-drawers{background:#323949;}.snap-drawer{background:#323949;color:#eee;}.snap-drawerh3{font-size:36px;font-weight:normal;margin:15px;}.snap-drawerh4{padding:15px;border-top:1pxsolidrgba(255,255,255,0.1);margin-bottom:0;}.snap-drawerul{padding:0;margin:0;list-style-type:none;}.snap-drawerli>a{display:block;border-bottom:1pxsolidrgba(0,0,0,0.1);border-top:1pxsolidrgba(255,255,255,0.1);padding:15px;font-weight:bold;text-shadow:01px0#000;text-decoration:none;color:#ccc;text-indent:20px;}.snap-drawerp{opacity:0.5;padding:15px;font-size:12px;}