S
S
strelkovandrey2017-11-30 13:30:02
PHP
strelkovandrey, 2017-11-30 13:30:02

How to intercept clicks on elements of an SVG file using jQuery?

Good afternoon, is it possible to intercept clicks on objects of the SVG file
Namely, the page displays the SVG file using the html method (or not the essence)
This file is a set of all kinds of different polygons, each polygon has its own ID

The simplest example of what needs to be done is when clicking on any of the elements, alert its ID. I
found an article about this https://blog.mimacom.com/blog/2017/04/27/how-to-cr...
my svg does not respond to clicks

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dmitry Derepko, 2019-09-15
@xEpozZ

$string = '.carousel-fade .carousel-item-next.carousel-item-left, .carousel-fade .carousel-item-prev.carousel-item-right, .carousel-fade .carousel-item.active {';
$prefix = '#elements';

$references = explode(', ', $string);
echo $prefix . ' ' . implode($prefix, $references);

It remains to select the desired part (css-classes) and apply the function to it.

E
Edward, 2019-09-15
@IS-Builder

@Vadim1899
\.\w+-\w+(?=\h)

A
ant2015, 2017-11-30
@ant2015

As with html code: assign a class or ID to svg elements. Or by tag name. There's a path, it seems.

T
tyzberd, 2017-11-30
@tyzberd

https://codepen.io/anon/pen/WXYaON?page=1&

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question