How to add an element Click Event in html5 svg

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.