iScroll won't let items be clicked

前端 未结 9 2117
长情又很酷
长情又很酷 2021-02-07 05:41

I am using iScroll4 and it\'s working great!

This are the functions I use to init, refresh and end iScroll:

function iniciarIscroll(){
    /*En ie7 no lo         


        
9条回答
  •  难免孤独
    2021-02-07 06:14

    I also have been working on making things scroll smoothly in the mobile environment and iscroll was one of the libraries I considered in my search for the right tool. Other answers have suggested how you can fix your specific problem but I would actually suggest using either scrollability (by Joe Hewitt) or touchscroll (by David Aurelio). I think that scrollability actually offers the best feel but it isn't really done and you would end up facing the same or similar issues. I am personally using touchscroll for a project of mine and I recommend it.

    I had to put in custom clicking actions and timeout checking when I was experimenting with iscroll a few weeks ago in my project and I did so by commenting out the e.preventDefault() on the start of the touch and inserting some of my own functions to catch when it actually scrolls. At their heart these libraries all work the same way (catching events and preventing them, running css transforms to make smoother than DOM-redrawing animations, then artificially firing any events that should be fired). This means the other way you can fix it is to find when the event of the click for your specific elements should happen and fire it manually in the code. In touchscroll it listens for events on the uppermost element so you can overwrite behavior by simply stopping bubbling... I can't remember if iscroll does the same.

    This (smooth, native feeling, animation in mobile) is still an area which is at the edge of the various technologies so no one has the complete solution yet. I would expect in a few years, mobile improve so that mobile browsers just handle scroll events natively anyway but until then we are forced to hack together solutions like these. Good luck!

提交回复
热议问题