Fastclick plug-in causes the date (input [type = "date"]) control to fail to be triggered.
As a newbie, this article is not a good place to write. I would like to share with you the following solutions and my personal opinions, if you have different opinions and solutions, please share your solutions.
First of all, the original intention of using the fastclick plug-in is to solve the "tap" Event "Point-through" BUG; both fastclick and tap use the "touch" event to simulate the "click" event;
Next, let's take a rough look at the working principle of fastclick (from copy on top ):
Trace all TouchStart events in our app, and trigger a click event when the touchend event is received;
You can find du Niang for the usage method;
However, the problem arises. When fastclick is used, we find that the "date" control cannot be triggered, but it cannot be triggered normally, if you press for seconds, it can still be triggered, but the problem still exists and must be solved!
Read the fastclick source code to find this method in it.
As mentioned above, a click event is triggered when the touchend event is received;
My solution is:
When touchendis used, we will wait for us to determine what other event.tar get is. If it is date, we will not play it anymore. If it is not your fastclick, it will not be OK if it is triggered by native. return false;
My code:
Here, if the conditions are written as needed, you can decide based on the project requirements. What you need is to exit the project when a special condition is reached;
As a newbie, this article is not a good place to write. I would like to share with you the following solutions and my personal opinions, if you have different opinions and solutions, please share your solutions. Thank you for your attention in this article. I will do better with your support.