CharisKomos (Talk | contribs) |
CharisKomos (Talk | contribs) |
||
Line 25: | Line 25: | ||
{ | { | ||
'id' : 'asteris_mirna_xA0_Image', | 'id' : 'asteris_mirna_xA0_Image', | ||
− | ' | + | 'translate_before' : 'matrix(0.48, 0, 0, 0.48, -85, 15.8398)' |
}, | }, | ||
{ | { | ||
'id' : 'eugene_mirna_xA0_Image', | 'id' : 'eugene_mirna_xA0_Image', | ||
− | ' | + | 'translate_before' : 'matrix(0.48, 0, 0, 0.48, -85, 87.8398)' |
}, | }, | ||
{ | { | ||
'id' : 'charis_mirna_xA0_Image', | 'id' : 'charis_mirna_xA0_Image', | ||
− | ' | + | 'translate_before' : 'matrix(0.48, 0, 0, 0.48, -85, 158.8799)' |
}, | }, | ||
{ | { | ||
'id' : 'thomas_mirna_xA0_Image', | 'id' : 'thomas_mirna_xA0_Image', | ||
− | ' | + | 'translate_before' : 'matrix(0.48, 0, 0, 0.48, -85, 229.9199)' |
}, | }, | ||
{ | { | ||
'id' : 'elissavet_mirna_xA0_Image', | 'id' : 'elissavet_mirna_xA0_Image', | ||
− | ' | + | 'translate_before' : 'matrix(0.48, 0, 0, 0.48, -85, 301.9199)' |
} | } | ||
]; | ]; | ||
Line 47: | Line 47: | ||
{ | { | ||
'id' : 'constantine_mirna_xA0_Image', | 'id' : 'constantine_mirna_xA0_Image', | ||
− | ' | + | 'translate_before' : 'matrix(0.48, 0, 0, 0.48, 877, 11.04)' |
}, | }, | ||
{ | { | ||
'id' : 'komos_mirna_xA0_Image', | 'id' : 'komos_mirna_xA0_Image', | ||
− | ' | + | 'translate_before' : 'matrix(0.48, 0, 0, 0.48, 877, 72.96)' |
}, | }, | ||
{ | { | ||
'id' : 'agg_mirna_xA0_Image', | 'id' : 'agg_mirna_xA0_Image', | ||
− | ' | + | 'translate_before' : 'matrix(0.48, 0, 0, 0.48, 877, 137.7598)' |
}, | }, | ||
{ | { | ||
'id' : 'nafsika_mirna_xA0_Image', | 'id' : 'nafsika_mirna_xA0_Image', | ||
− | ' | + | 'translate_before' : 'matrix(0.48, 0, 0, 0.48, 877, 198.7197)' |
}, | }, | ||
{ | { | ||
'id' : 'kst_mirna_xA0_Image', | 'id' : 'kst_mirna_xA0_Image', | ||
− | ' | + | 'translate_before' : 'matrix(0.48, 0, 0, 0.48, 877, 263.04)' |
}, | }, | ||
{ | { | ||
'id' : 'thanasis_mirna_xA0_Image', | 'id' : 'thanasis_mirna_xA0_Image', | ||
− | ' | + | 'translate_before' : 'matrix(0.48, 0, 0, 0.48, 877, 323.5195)' |
} | } | ||
]; | ]; | ||
+ | function svgFunctionality(element){ | ||
+ | $('#' + element.id).css('cursor', 'pointer'); | ||
+ | leftElements.forEach(function(item, index, array){ | ||
+ | if(item.id != element.id){ | ||
+ | svgDoc.getElementById(item.id).setAttribute('transform', item.translate_before); | ||
+ | }else{ | ||
+ | svgDoc.getElementById(item.id).setAttribute('transform', item.translate_after); | ||
+ | } | ||
+ | |||
+ | rightElements.forEach(function(item, index, array){ | ||
+ | if(item.id != element.id){ | ||
+ | svgDoc.getElementById(item.id).setAttribute('transform', item.translate_before); | ||
+ | }else{ | ||
+ | svgDoc.getElementById(item.id).setAttribute('transform', item.translate_after); | ||
+ | } | ||
+ | }); | ||
+ | } | ||
mySVG.addEventListener("load",function() { | mySVG.addEventListener("load",function() { | ||
Line 79: | Line 96: | ||
console.log('item: ' + item.id); | console.log('item: ' + item.id); | ||
console.log('index: ' + index); | console.log('index: ' + index); | ||
− | svgDoc.getElementById(item.id).setAttribute('transform', item. | + | svgDoc.getElementById(item.id).setAttribute('transform', item.translate_before); |
+ | svgDoc.getElementById(item.id).addEventListener('click', function(){ svgFunctionality(item) }); | ||
}); | }); | ||
Line 85: | Line 103: | ||
console.log('item: ' + item.id); | console.log('item: ' + item.id); | ||
console.log('index: ' + index); | console.log('index: ' + index); | ||
− | svgDoc.getElementById(item.id).setAttribute('transform', item. | + | svgDoc.getElementById(item.id).setAttribute('transform', item.translate_before); |
+ | svgDoc.getElementById(item.id).addEventListener('click', function(){ svgFunctionality(item) }); | ||
}); | }); | ||
Revision as of 15:13, 21 October 2017