Answer the question
In order to leave comments, you need to log in
ajax svg processing. How to do it right?
There is a function that loads an svg file into the wordpress backend layer and then loops through it. In the loop, there is a check for a match between the id of the svg element and the array element. If there is a match, jQuery changes the element's fill attribute to red.
The problem is that visually the style "rolls back" to its original state. For a fraction of a second, showing a red fill, the element turns white again. At the same time, the same function "in the front" works correctly
function get_rented_objects(url){
var vectors=["Vector_16","Vector_4"];
jQuery(".svg-container").load( url );
jQuery('#svg_item_list').empty();
jQuery('.room').each(function(){
var id = jQuery(this).attr('id');
if(jQuery.inArray(id,vectors)!='-1'){
jQuery(this).attr("fill","red");
}
});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question