plugins/touchswipe.js
function validateDefaultEvent(jqEvent, direction) {

			//If we have no pinches, then do this
			//If we have a pinch, and we we have 2 fingers or more down, then dont allow page scroll.

			//If the option is set, allways allow the event to bubble up (let user handle wiredness)
			if( options.preventDefaultEvents === false) {
				return;
			}

			if (options.allowPageScroll === NONE) {
				jqEvent.preventDefault();
			} else {
				var auto = options.allowPageScroll === AUTO;

				switch (direction) {
					case LEFT:
						if ((options.swipeLeft && auto) || (!auto && options.allowPageScroll != HORIZONTAL)) {
							jqEvent.preventDefault();
						}
						break;

					case RIGHT:
						if ((options.swipeRight && auto) || (!auto && options.allowPageScroll != HORIZONTAL)) {
							jqEvent.preventDefault();
						}
						break;

					case UP:
						if ((options.swipeUp && auto) || (!auto && options.allowPageScroll != VERTICAL)) {
							jqEvent.preventDefault();
						}
						break;

					case DOWN:
						if ((options.swipeDown && auto) || (!auto && options.allowPageScroll != VERTICAL)) {
							jqEvent.preventDefault();
						}
						break;
				}
			}

		}
function validateDefaultEvent(jqEvent, direction) {

			//If we have no pinches, then do this
			//If we have a pinch, and we we have 2 fingers or more down, then dont allow page scroll.

			//If the option is set, allways allow the event to bubble up (let user handle wiredness)
			if( options.preventDefaultEvents === false) {
				return;
			}

			if (options.allowPageScroll === NONE) {
				jqEvent.preventDefault();
			} else {
				var auto = options.allowPageScroll === AUTO;

				switch (direction) {
					case LEFT:
						if ((options.swipeLeft && auto) || (!auto && options.allowPageScroll != HORIZONTAL)) {
							jqEvent.preventDefault();
						}
						break;

					case RIGHT:
						if ((options.swipeRight && auto) || (!auto && options.allowPageScroll != HORIZONTAL)) {
							jqEvent.preventDefault();
						}
						break;

					case UP:
						if ((options.swipeUp && auto) || (!auto && options.allowPageScroll != VERTICAL)) {
							jqEvent.preventDefault();
						}
						break;

					case DOWN:
						if ((options.swipeDown && auto) || (!auto && options.allowPageScroll != VERTICAL)) {
							jqEvent.preventDefault();
						}
						break;
				}
			}

		}
function validateDefaultEvent ( jqEvent , direction ) { //If we have no pinches, then do this //If we have a pinch, and we we have 2 fingers or more down, then dont allow page scroll. //If the option is set, allways allow the event to bubble up (let user handle wiredness) if ( options . preventDefaultEvents === false ) { return ; } if ( options . allowPageScroll === NONE ) { jqEvent . preventDefault ( ) ; } else { var auto = options . allowPageScroll === AUTO ; switch ( direction ) { case LEFT : if ( ( options . swipeLeft && auto ) || ( ! auto && options . allowPageScroll != HORIZONTAL ) ) { jqEvent . preventDefault ( ) ; } break ; case RIGHT : if ( ( options . swipeRight && auto ) || ( ! auto && options . allowPageScroll != HORIZONTAL ) ) { jqEvent . preventDefault ( ) ; } break ; case UP : if ( ( options . swipeUp && auto ) || ( ! auto && options . allowPageScroll != VERTICAL ) ) { jqEvent . preventDefault ( ) ; } break ; case DOWN : if ( ( options . swipeDown && auto ) || ( ! auto && options . allowPageScroll != VERTICAL ) ) { jqEvent . preventDefault ( ) ; } break ; } } }
Checks direction of the swipe and the value allowPageScroll to see if we should allow or prevent the default behaviour from occurring.
This will essentially allow page scrolling or not when the user is swiping on a touchSwipe object.
@param {object} jqEvent The normalised jQuery representation of the event object.
@param {string} direction The direction of the event. See {@link $.fn.swipe.directions}
@see $.fn.swipe.directions
@inner
Checks direction of the swipe and the value allowPageScroll to see if we should allow or prevent the default behaviour from occurring . This will essentially allow page scrolling or not when the user is swiping on a touchSwipe object .