13.03.2017, 16:42
(This post was last modified: 13.03.2017, 20:17 by Erwin van der Zwart.)
Hi Thomas,
Here is a random SVG file i downloaded and i added some JS to it (;
For details how i did it see EOF and noticed the ID mercury i attached to the object listener inside this SVG.
Basicly i added this code into the SVG just above EOF </svg> and attached it to the bar element with ID "mercury" :
Now attached to address 1/1/17 as 2 byte float with min/max 0-35
BR,
Erwin
Here is a random SVG file i downloaded and i added some JS to it (;
For details how i did it see EOF and noticed the ID mercury i attached to the object listener inside this SVG.
Basicly i added this code into the SVG just above EOF </svg> and attached it to the bar element with ID "mercury" :
Code:
<defs>
<script type="text/javascript">
<![CDATA[
var p = window.parent, el;
el = document.getElementById('mercury');
if (p) {
if (typeof p.grp != 'undefined') {
p.grp.listen('1/1/17', function(object, state) {
el.setAttribute('height', Math.round(object.value / 3.5));
}, false);
}
}
]]>
</script>
</defs>
thermometer.svg (Size: 9.76 KB / Downloads: 101)
BR,
Erwin