Comments: Recently, svg click events have been used. The reason why svg is used instead of canvas is that the elements in svg can be used to add click events. Next, we will introduce the adding method in detail, interested friends can learn about the recently used svg click events to do things. The reason why svg is used instead of canvas is that the elements in svg can add click events, the detailed differences between them are as follows:
Comparison between Canvas and SVG (SEE)
The following table lists some differences between canvas and SVG.
Canvas
• Dependency resolution
• Event processors are not supported
• Weak text rendering capabilities
• The result image can be saved in. png or. jpg format.
• Most Suitable for image-intensive games, many of which are frequently repainted
SVG
• Resolution independent
• Support for event Processors
• Ideal for applications with large rendering areas (such as Google Maps)
• High complexity slows down the rendering speed (any applications that use DOM excessively are not fast)
• Not Suitable for game applications
The webpage can be used normally under chorme. To support mobile devices, the test on android is also normal. However, when the page is opened on ipad, it is found that the click event is useless, I checked a lot of information and did not find the cause of the problem. Later I found that the demo described by svg in w3c can indeed achieve the click effect and compare the code, find the Click Event added to the svg element by jquery, but there is no similar description of onclick = "circle_click (evt)" in the svg element, add onclick = "click (evt)" and the svg element on the ipad has a click event.