laviastar / iscroll-js

Automatically exported from code.google.com/p/iscroll-js
MIT License
2 stars 2 forks source link

Sliders and buttons don't work or don't work well in iScroll #54

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Create a scrolling element
2.add sliders (any kind mootools,jquerry etc.)
3.or add any kind of touch input (buttons, raios, checkbox)

What is the expected output? What do you see instead?
The input to react to your touch. It doesn't

What version of the product are you using? On what operating system?
4 beta

Please provide any additional information below.

It seams that iScrols blocks the touch events form being interpreted by other 
elements in the scroll. 
I solved the problem by adding a delay in the handleEvent that gives the 
buttons and the others enough time to get pressed. In my case scroll was a dive 
since you can't have a range input in Phonegap and i surrounded my div whit and 
a tag that had href="javascript:null". 

handleEvent: function (e) {

        //begin modification
        if (e.target.tagName == "A")//or DIV UL LI etc any html tag
        {setTimeout( function(){for(i=0;i<=1000;i+){}},250);
         //I haven't fine tuned the delay so be my guest to try lower values
        } 
        //end modification

        var that = this;

        switch (e.type) 
...

Original issue reported on code.google.com by obog...@gmail.com on 28 Mar 2011 at 2:31

GoogleCodeExporter commented 9 years ago
later it seems that the solution works only id the is no need to scroll. I have 
maneged to make the elements respond unsing alert to interupt the handleEvent 
function

Original comment by obog...@gmail.com on 28 Mar 2011 at 2:46

GoogleCodeExporter commented 9 years ago
later found a preaty weird sollution that enable scrolling and touching the 
sliders. Since the sliders are divs I modified the touchStart function in 
iScroll.js by placing
if (e.target.tagName != "DIV"){
e.preventDefault();
 e.stopPropagation();           
} 

instead of:

 e.preventDefault();
e.stopPropagation();

and it works like a charm :|. This is very weird since 98 of the  html test 
file is made out of divs. This should work for all input types.
Cheers

Original comment by obog...@gmail.com on 29 Mar 2011 at 12:11