Skip to content

PKUI.CORE.applyTouchListeners

kerrishotts edited this page Nov 14, 2012 · 1 revision

(part of PKUI.CORE)

Return Type: void

Parameters: none

Iterates through all buttons and as and adds touchstart and touchend event handlers to them in order to allow handling of the touched class.

When one of the elements receives a touchstart event, the touched class will be added. When the touchend is received, the touched class will be removed. This lets us target styles for touched elements, much like we might for hovered or active elements on the desktop.

Example:

PKUI.CORE.applyTouchListeners();

Notes

  • Will only apply listeners to elements that have not previously received listeners. An attribute is attached to those elements that have received elements so that they aren't touched again.
  • Normally called every 100ms so that changes in the DOM are automatically handled. If the DOM is quite large, however, it is possible that this will have a negative performance impact on the app. In that case, PKUI.CORE.listenerInterval should be set to 0 in the framework.ui-core.js file and then this method should be called manually after any DOM change that might need touch listeners applied.

Version

0.1 Introduced

0.2 Docs Valid

Clone this wiki locally