Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Option hasForm to allow events on form elements #128

Closed
wants to merge 1 commit into from

3 participants

@psema4

Hi cubiq,

Rather than people hacking the iscroll.js sources to get text input, textarea and select elements working again*, I suspect it might be easier (and less frustrating) for users if a configuration option was available until a better solution can be found.

This pull request includes a config option called "hasForm" that enables these elements.

Known issue: On Android 2.3.2 select elements appear to only work intermittently for me... still chasing it down.

Best regards

@pnegri

No, we allready have a better one, see pull requests. This kinda of hack isnt good!

@psema4

@pnegri - Can you clarify which pull request provides a better solution? I'm trying to help the author of a question over on StackOverflow: http://stackoverflow.com/questions/8345644/iscroll-wont-let-items-be-clicked

@psema4

Thanks @pnegri - I'll test 145 on Android when I get a few moments

@cubiq cubiq closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 30, 2011
  1. @psema4
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 2 deletions.
  1. +15 −2 src/iscroll.js
View
17 src/iscroll.js
@@ -90,9 +90,22 @@ var m = Math,
snap: false,
snapThreshold: 1,
+ // Support forms?
+ hasForm: false, // Experimental
+
// Events
onRefresh: null,
- onBeforeScrollStart: function (e) { e.preventDefault(); },
+ onBeforeScrollStart: function (e) {
+ if (that.options.hasForm) {
+ var targetTag = e.target.tagName.toLowerCase();
+ if (targetTag != 'input' && targetTag != 'select' && targetTag != 'textarea') {
+ e.preventDefault();
+ }
+
+ } else {
+ e.preventDefault();
+ }
+ },
onScrollStart: null,
onBeforeScrollMove: null,
onScrollMove: null,
@@ -113,7 +126,7 @@ var m = Math,
}
// User defined options
for (i in options) that.options[i] = options[i];
-
+console.log('hasForm: ' + that.options.hasForm);
// Set starting position
that.x = that.options.x;
that.y = that.options.y;
Something went wrong with that request. Please try again.