Giter Site home page Giter Site logo

Comments (5)

HcySunYang avatar HcySunYang commented on May 19, 2024

单凭这句话我很难准确的定位真正的问题所在,不过我可以猜测一下:
你的按钮是不是使用了 touchstart/touchend 事件,而不是click事件?

from finger-mover.

fisherw avatar fisherw commented on May 19, 2024

场景:页面元素中有按钮(我只监听onclick事件),手机上手指触屏滚动时,当手指刚好触到按钮的时候,会触发按钮的点击。

这个应该很容易重现到。

from finger-mover.

zaxlct avatar zaxlct commented on May 19, 2024

@fisherw
Talk is cheap. Show me the code.

from finger-mover.

fisherw avatar fisherw commented on May 19, 2024

。。。。

from finger-mover.

keepfool avatar keepfool commented on May 19, 2024

场景:在一个宫格页面,每个宫格绑定click事件,上滑或者下滑时可能会触发宫格的click事件。
解决方法,修改src/fingerd.js,在处理touchend和touchcancel时阻止事件冒泡

injectEvent (event) {
        if (eventType === EVENT_TYPE.touchend || eventType === EVENT_TYPE.touchcancel) {
            // 阻止事件冒泡,避免在滚动时触发页面元素的click事件
            event.cancelBubble = true
        }
}

from finger-mover.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.