Comment: I have been using svg's click event to make things recently. The reason I use svg instead of canvas is because the elements in svg can add click events. Next, let's introduce the addition method in detail. Interested friends can learn about it.
Recently, I have been using svg's click event to make things. The reason I use svg instead of canvas is because elements in svg can add click events. The detailed difference between them is as follows:Comparison between Canvas and SVG (see details)
The following table lists some differences between canvas and SVG.
Canvas
•Resolution-dependent
•Event handler is not supported
• Weak text rendering ability
•Ability to save result images in .png or .jpg format
• Best for image-intensive games, many of which are frequently repainted
SVG
•Resolution-free
•Support event handlers
• Best for applications with large rendering areas (such as Google Maps)
•High complexity can slow down rendering (no application that overuses DOM)
• Not suitable for gaming applications
The web page made can be used normally under chorme because it supports mobile devices and is also normal to test on Android. However, when opening the page on ipad, I found that the click event was useless. I checked a lot of information and found that the reason for the problem. Later, I found that the demo of the description of svg in w3c can indeed achieve the click effect. Compared with the code, I found that the click event added to the elements of svg by jquery, and there is no description of onclick=circle_click(evt) in the elements of svg. I added onclick=click(evt) and indeed there is a click event on the elements of svg on ipad.