Class Hammer
Class defined in:src/setup.js:1
Hammer
( element, [options={}]
)
src/setup.js:9
Hammer, use this to create instances
var hammertime = new Hammer(myElement);
Parameters:
-
element
<HTMLElement> -
[options={}]
<Object>
CALCULATE_INTERVAL
<Number>
src/setup.js:151
interval in which Hammer recalculates current velocity/direction/angle in ms
Default: 25defaults
<Object>
src/setup.js:33
default settings.
more settings are defined per gesture at /gestures
. Each gesture can be disabled/enabled
by setting it's name (like swipe
) to false.
You can set the defaults for all instances by changing this object before creating an instance.
Example
Hammer.defaults.drag = false;
Hammer.defaults.behavior.touchAction = 'pan-y';
delete Hammer.defaults.behavior.userSelect;
defaults.behavior
<Object>
src/setup.js:48
this setting object adds styles and attributes to the element to prevent the browser from doing its native behavior. The css properties are auto prefixed for the browsers when needed.
defaults.behavior.contentZooming
<String>
src/setup.js:83
Specifies whether zooming is enabled. Used by IE10>
Default: 'none'defaults.behavior.tapHighlightColor
<String>
src/setup.js:100
Overrides the highlight color shown when the user taps a link or a JavaScript clickable element in Safari on iPhone. This property obeys the alpha value, if specified.
If you don't specify an alpha value, Safari on iPhone applies a default alpha value to the color. To disable tap highlighting, set the alpha value to 0 (invisible). If you set the alpha value to 1.0 (opaque), the element is not visible when tapped.
Default: 'rgba(0,0,0,0)'defaults.behavior.touchAction
<String>
src/setup.js:64
Specifies whether and how a given region can be manipulated by the user (for instance, by panning or zooming). Used by IE10>. By default this makes the element blocking any touch event.
Default: : 'none'defaults.behavior.touchCallout
<String>
src/setup.js:73
Disables the default callout shown when you touch and hold a touch target. On iOS, when you touch and hold a touch target such as a link, Safari displays a callout containing information about the link. This property allows you to disable that callout.
Default: 'none'defaults.behavior.userDrag
<String>
src/setup.js:91
Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
Default: 'none'defaults.behavior.userSelect
<String>
src/setup.js:55
Disables text selection to improve the dragging gesture. When the value is none
it also sets
onselectstart=false
for IE on the element. Mainly for desktop browsers.
DIRECTION_DOWN|LEFT|UP|RIGHT
<String>
(final)
src/setup.js:169
direction strings, for safe comparisons
Default: 'down' 'left' 'up' 'right'DOCUMENT
<HTMLElement>
src/setup.js:115
hammer document where the base events are added at
Default: window.documentEVENT_START|MOVE|END|RELEASE|TOUCH
<String>
(final)
src/setup.js:192
eventtypes
Default: 'start' 'change' 'move' 'end' 'release' 'touch'EVENT_TYPES
<Object>
src/setup.js:159
eventtypes per touchevent (start, move, end) are filled by Event.determineEventTypes
on setup
the object contains the DOM event names per type (EVENT_START
, EVENT_MOVE
, EVENT_END
)
POINTER_MOUSE|TOUCH|PEN
<String>
(final)
src/setup.js:181
pointertype strings, for safe comparisons
Default: 'mouse' 'touch' 'pen'VERSION
<String>
(final)
src/setup.js:24
version, as defined in package.json the value will be set at each build