简体   繁体   English

Javascript /移动设备-onClick()在移动设备上不起作用

[英]Javascript/Mobile - onClick() wont work on mobile devices

We have a website that when you click on the text it reads to you what is displayed. 我们有一个网站,当您单击文本时,它会向您显示所显示的内容。 This works 100% for computers but on mobile devices it will not play the audio. 这对于计算机而言100%有效,但在移动设备上将无法播放音频。

I have looked around the web but everything is pointing to Jquery using touchstart . 我环顾了网上,但一切都使用touchstart指向了Jquery。 We tried doing this but it then breaks on computers. 我们尝试这样做,但随后在计算机上中断。

Anyone run into issues like this? 有人遇到这样的问题吗? If so, how did you fix it? 如果是这样,您如何解决?

I think this was an issue with older versions of react. 我认为这是旧版本的React的问题。 I haven't had the problem recently. 我最近没有这个问题。 In the past, I solved it by adding cursor: pointer; 过去,我通过添加cursor: pointer;来解决此问题cursor: pointer; to the CSS of the element. 到元素的CSS。 It had something to do with events not firing on elements that aren't usually 'clickable'. 它与事件不触发通常不是“可点击”的元素有关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM