M
M
Mikhail Zakharov2015-12-08 13:07:34
JavaScript
Mikhail Zakharov, 2015-12-08 13:07:34

jquery and svg and accordeon plugin?

The gist is this:
There are five tabs created with the Accordeon plugin in juqery ui, each containing one svg. I manage them with jquery. The first svg is managed without problems, while the svgs on the rest of the tabs are not responsive. Moreover, when switching back to the first tab, the svg contained in it also does not respond to events. And in the console elements are recognized normally. Please help. I am attaching the code.

function stages(index) {
if (!index) {
index == 0;
}
svgobject = document.getElementById('imap'+index);
svgdom = jQuery(svgobject.contentDocument);
$("g, path", svgdom).css({"transition":"1s","cursor":"pointer"});
$("path", svgdom).css({"fill":"red","opacity":".3"});
$("g, path", svgdom).click(function(){
id = $(this).attr("id").slice(4)
$(".lje[href="+id+"]") .click();
});
}


stages(index) - a function that is called when switching to other tabs, where index is the tab number (for linking with svg). This part works fine. But here the active svg is not responsive.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Zakharov, 2015-12-08
@cashalot

I'll answer myself.
JS doesn't see SVG in block with display:none;
I had to go with crutches, but now everything works. I hide the blocks, and when clicked, I display:

.ui-tabs [aria-hidden=true] {
    position: absolute;
    display: block !important;
    left: -10000px;
    height: 0;
}
.ui-tabs [aria-hidden=false] {
    position: relative;
    display: block !important;
    left: initial;
    height: initial;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question