Buon pomeriggio a tutti!!!
Ho un problema con ajax ed svg. Ho il seguente codice
codice:
$.ajax({
url: url, dataType: "xml",
success: function(svgDoc){
var importedSVGRootElement = document.importNode(svgDoc.documentElement,true);
$("#svgimage" + currentid).html(importedSVGRootElement);
$("#svgimage" + currentid).find('svg').attr('width','870px');
$("#svgimage" + currentid).find('svg').attr('height','430px');
$('#colori' + currentid).find('.locked').remove();
$('#colori' + currentid).find('.colorPicker-picker').remove();
$("#svgimage" + currentid).find('path').each(function(){
if(this.id.indexOf('Locked')!=-1){ this.addEventListener("mouseup",function(e){
$(".newpal1").show();
Global.colorPickerCorrente = $("input[name="+$(this).attr('id')+"]").next(); Global.inputColorCorrente = $("input[name="+$(this).attr('id')+"]")[0]; console.log(Global.inputColorCorrente);
Global.lastColor = $(this).attr("fill");
Global.corrente = $(this).attr('id'); e.stopPropagation();
},true);
this.id = this.id + "_" + parseInt(Math.random()*1000);
var id = this.id;
$(this).hover(function(){$('body').addClass('cur');$("body").css("cursor", "cursor.cur"); $(this).attr("stroke","#36FF00"); $(this).attr("stroke-width",Global.strokeWidth);
},function(){
$(this).attr("stroke-width","0");
$('body').removeClass('cur');
});
Vorrei fare la stessa cosa oltre che per i path anche per i polygon. se sostituisco path con polygon nello stesso codice funziona, ma se dopo le parentesi ricopio il codice per farli funzionare contemporaneamente cambiando solo path con polygon non funziona più nulla.
Qualcuno ha qualche idea in merito???