jakiestfu /Snap.js

A Library for creating beautiful mobile shelfs in Javascript (Facebook and Path style side menus)

★ 5,944⑂ 643👁 186⑃ 69● 219▤ 2
JavaScriptCreated 2013-04-01jakiestfu.github.io/Snap.js/
下载:1.9.3Snap.js-1.9.3 ↓1.9.32014-06-18
+0
日增长
5,944
stars
643
forks
186
watchers
69
prs
219
issues
2
releases

README

Snap.js
A Library for creating beautiful mobile shelfs in Javascript

View Video Preview

View Demos



 Features
 Support
 Installation
 Usage
 Settings & Defaults
 Public Methods
 Gotchas
 FAQ's
 Compliments
 Licensing
 Extras

 Features
 Library Independent
 High Customization
 Flick Support
 User Intent Detection
 Disable Hyperextension
 Event Hooks
 CSS3 Powered Animations with IE fallbacks
 Drag Support
 Drag Handle Support
 Programatic API
 "No-Drag" Elements
 Definable Easing Mode
 Enable/Disable Events
 Disabled Sides (left or right)
 Supports Ratchet (with templates!)

 Support
 Firefox 10+
 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



As a web component do:

shell
$ component install jakiestfu/Snap.js


 Usage

javascript
var snapper = new Snap({
  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. On

Top issues

Latest release

1.9.3 1.9.3 2014-06-18

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON