Leap
Leap interaction classes and tools.
Read this page for great web-based Leap functionality.
Leap interaction classes and tools.
Read this page for great web-based Leap functionality.
Just give your element a class of leap-interactive
to make it interactive.
<button type="button" class="btn leap-interactive">I can be clicked</button>
Name | type | default | description |
---|---|---|---|
class="leap-interactive" | element class | activate leap interaction on this element |
Set a click delay on your elements.
<button type="button" class="btn leap-interactive" leap-click-delay="1000">Click Delay: 1 second </button>
<button type="button" class="btn leap-interactive" leap-click-delay="3000">Click Delay: 3 second </button>
<button type="button" class="btn leap-interactive" leap-click-delay="5000">Click Delay: 5 second </button>
Name | type | default | description |
---|---|---|---|
leap-click-delay | number | 1000 | time to wait until activate click on element (in ms) |
Allow an element to be tapped multiple times
<button type="button" class="btn leap-interactive" leap-enable-multitap="true">Allow Multitap</button>
Name | type | default | description |
---|---|---|---|
leap-enable-multitap | boolean | false | allow element to be tapped by leap more than once |
Set a click delay on your elements.
<button type="button" class="btn leap-interactive" leap-disable-tap="true">Can't tap me</button>
<button type="button" class="btn leap-interactive" leap-disable-tap="true" leap-disable-hover="true">Can't tap or hover me</button>
Name | type | default | description |
---|---|---|---|
leap-disable-tap | boolean | false | don't allow leap tap |
leap-disable-hover | boolean | false | don't allow leap hover |
Set a click delay on your elements.
<button type="button" class="btn leap-interactive" leap-attractor="true">Standard Attraction</button>
<button type="button" class="btn leap-interactive" leap-attractor-x-padding="10">10px wide</button>
<button type="button" class="btn leap-interactive" leap-attractor-y-padding="10">10px tall</button>
<button type="button" class="btn leap-interactive" leap-attractor-x-padding="30" leap-attractor-y-padding="30">30px wide+tall</button>
Name | type | default | description |
---|---|---|---|
leap-attractor | boolean | false | activate standard attractor |
leap-attractor-x-padding | number | 0 | add horizontal attractor padding (in px) |
leap-attractor-y-padding | number | 0 | add vertical attractor padding px (in px) |
Move your hand over this box to see actions
Add leap-interactive to any element and you can use it to detect for gestures.
<button type="button" class="btn leap-interactive">Make a circle on me</button>
You can enable Meta gestures, like Page Back and Page Forward, if you enable the default on-page Meta actions.
Browser should go page back.
Browser should go page forward.
enableMetaGestures: true,
enableDefaultMetaGestureActions: true
<script>
LeapManager.init({
interactiveSelector: "a",
maxCursors:3,
enableMetaGestures: true,
enableDefaultMetaGestureActions: true
});
</script>
Move your finger in a circle to scroll the page
To enable page scrolling, attach leap-interactive
to your body element. You probably don't need tap or hover on the body, so disable them.
<body class="leap-interactive" leap-disable-tap="true" leap-disable-hover="true">
enableMetaGestures: true,
enableDefaultMetaGestureActions: true
<script>
LeapManager.init({
interactiveSelector: "a",
maxCursors:3,
enableMetaGestures: true,
enableDefaultMetaGestureActions: true
});
</script>
Move your finger in a circle over these elements to scroll through them
<button type="button" class="catcher btn leap-interactive">Make a circle on me</button>
Use the built-in LeapManager to get started with Leap on your page. Each page needs to use LeapManager to initialise Leap. You just include some Javascript, typically defining the maximum amount of fingers you want the page to use.
We show interactiveSelector: "a"
in our examples, but you shouldn't use it. It typically makes Leap slower, especially if you've got lots of links on the page (dropdown menus, navigation, options etc). Leapstrap will apply Leap interaction to any element with a class of leap-interactive
- you should use that instead if you can.
<script>
LeapManager.init({
interactiveSelector: "a",
maxCursors:3,
});
</script>
LeapManager.init({
interactiveSelector: "a",
enableMetaGestures: true,
enableDefaultMetaGestureActions: false,
maxCursors:3,
enableHoverTap: true,
enablePressDown: true,
enableTouchScrolling: false,
enableScrollbarScrolling: true,
simulateWithMouse:false,
mouseCursorConfig: {
easing:.2
},
greedySelector: "body"
});
Name | type | default | description |
---|---|---|---|
interactiveSelector | string | - | Not recommended for production use due to slow performance. Automatically set element types to be leap-interactive. Comma separated list of element types, classes or ids. interactiveSelector: "a, .btn, input, #myLeapBtn", |
enableMetaGestures | boolean | ||
enableDefaultMetaGestureActions | boolean | ||
maxCursors | number | - | |
enableHoverTap | boolean | ||
enablePressDown | boolean | ||
enableTouchScrolling | boolean | ||
enableScrollbarScrolling | boolean | ||
simulateWithMouse | boolean | false | |
mouseCursorConfig | options | Configuration for Mouse CursormouseCursorConfig: {
multitapEnabled: false,
clickDelay: 1000
} |
|
enableInBackground | boolean | false | Register Leap updates in the background |
root | Change the root HTMLElement for all Leap Elements | ||
gestureCallback | Callback function for globally catching Gestures | ||
gestureScope | Scope for global gesture callback | ||
enableSenchaTouch | boolean | false | Enable interactivity for a Sencha Touch Application |
loopConfig | Configs to pass into the Loop function for the leap (see leap library docs for more info)loopConfig: {
enableGestures: true
} |
||
boundary | Virtual Boundary inwhich to move your fingers around. Translates into screen spaceboundary: {
top: 350,
left: -100,
right: 100,
bottom: 150
} |
||
cursorConfig | Configuration for cursorscursorConfig: {
multitapEnabled: false,
clickDelay: 1000,
easing: .3
} |
||
greedySelector |
<a
class="btn leap-interactive"
leap-click-delay="5000"
leap-enable-multitap="true"
leap-disable-tap="true"
leap-disable-hover="true"
leap-attractor="true"
leap-attractor-x-padding="10"
leap-attractor-y-padding="10"
href="">
Your text
</a>
Name | type | default | description |
---|---|---|---|
class="leap-interactive" | element class | activate leap interaction on this element | |
leap-click-delay | number | 1000 | time to wait until activate click on element (in ms) |
leap-enable-multitap | boolean | false | allow element to be tapped by leap more than once |
leap-disable-tap | boolean | false | don't allow leap tap |
leap-disable-hover | boolean | false | don't allow leap hover |
leap-attractor | boolean | false | activate standard attractor |
leap-attractor-x-padding | number | 0 | add horizontal attractor padding (in px) |
leap-attractor-y-padding | number | 0 | add vertical attractor padding px (in px) |