From dbbe12c4c3d3c86f82709646a32e54d9d585cc10 Mon Sep 17 00:00:00 2001 From: Sven Minio Date: Sun, 17 May 2026 20:00:21 +0200 Subject: [PATCH] Add EVENTS Touch --- EVENTS-Touch.md | 185 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 EVENTS-Touch.md diff --git a/EVENTS-Touch.md b/EVENTS-Touch.md new file mode 100644 index 0000000..b632254 --- /dev/null +++ b/EVENTS-Touch.md @@ -0,0 +1,185 @@ +* [`touchstart`](#usage-touchstart) | [`touchend`](#usage-touchend) | [`touchmove`](#usage-touchmove) | [`touchcancel`](#usage-touchcancel) +* [`swipeLeft`](#usage-swipeLeft) | [`swipeRight`](#usage-swipeRight) | [`swipeUp`](#usage-swipeUp) | [`swipeDown`](#usage-swipeDown) + + +--- + +## .touchstart + +**Description** +Bind an event handler to the "touchstart" event (finger is placed on a touch surface). + +**Parameters** + +* `handler` (Function, optional): Function to execute. + +**Returns** + +* (jBase): Current instance. + +**Example** + +```javascript +$('.swipe-area').touchstart(function(e) { + console.log('Touch started'); +}); + +``` + +--- + +## .touchend + +**Description** +Bind an event handler to the "touchend" event (finger is removed from a touch surface). + +**Parameters** + +* `handler` (Function, optional): Function to execute. + +**Returns** + +* (jBase): Current instance. + +**Example** + +```javascript +$('.swipe-area').touchend(function(e) { + console.log('Touch ended'); +}); + +``` + +--- + +## .touchmove + +**Description** +Bind an event handler to the "touchmove" event (finger is dragged across the surface). + +**Parameters** + +* `handler` (Function, optional): Function to execute. + +**Returns** + +* (jBase): Current instance. + +**Example** + +```javascript +$('.swipe-area').touchmove(function(e) { + // prevent scrolling while swiping + e.preventDefault(); +}); + +``` + +--- + +## .touchcancel + +**Description** +Bind an event handler to the "touchcancel" event (system cancels the touch event). + +**Parameters** + +* `handler` (Function, optional): Function to execute. + +**Returns** + +* (jBase): Current instance. + +**Example** + +```javascript +$('.swipe-area').touchcancel(function() { + console.log('Touch cancelled'); +}); + +``` + +--- + +## .swipeLeft + +**Description** +Binds an event handler to be executed when the user swipes their finger to the left across the element. The swipe must cover a minimum distance of 50px. + +**Parameters** +* `handler` (Function): Function to execute on left swipe. + +**Returns** +* (jBase): Current instance. + +**Example** +```javascript +$('.carousel').swipeLeft(() => nextSlide()); +``` + +--- + +## .swipeRight +**Description** +Binds an event handler to be executed when the user swipes their finger to the right across the element. + +**Parameters** + + * `handler` (Function): Function to execute on right swipe. + +**Returns** + + * (jBase): Current instance. + +**Example** + +```javascript +$('.carousel').swipeRight(() => prevSlide()); +``` + +--- + +## .swipeUp + +**Description** +Binds an event handler to be executed when the user swipes their finger upwards across the element. + +**Parameters** + + * `handler` (Function): Function to execute on upward swipe. + +**Returns** + + * (jBase): Current instance. + +**Example** + +```javascript +$('.carousel').swipeUp(() => { + CloseWindow() +}); +``` + +--- + +## .swipeDown + +**Description** +Binds an event handler to be executed when the user swipes their finger downwards across the element. + +**Parameters** + + * `handler` (Function): Function to execute on downward swipe. + +**Returns** + + * (jBase): Current instance. + + +**Example** + +```javascript +$('.carousel').swipeDown(() => { + Reload(); +}); +``` \ No newline at end of file