UnitConverter

The UnitConverter library provides text boxes that allow authors to add unit conversion within any post or page. If you came directly to this demo site, please see our overview of the other EasyElements.

Two converter formats are available in the same library:

inOutBox

The inOutBox converter format receives an input number and unit in the left text box which are used to convert to the unit selected in the right box. As the input and output boxes are changed the calculation updates.

This element can be added to any WordPress page via a Custom HTML block containing these two lines:

<script defer src="https://dist.mechanomy.com/EasyElements/unitConverter.js"></script>

<div class="unitConverter" format="inOutBox" id="forceConversionTable" units="N:1, kN:1e-3, lbf:0.2248" style=""></div>

The first line loads the library from Mechanomy’s server and the second specifies the converter element. See the documentation on our main site.

table

The table converter format displays all of the units at the same time, with the input taken from whichever box was last changed.

<script defer src="https://dist.mechanomy.com/EasyElements/converter.js"></script>

<div class="unitConverter" format="table" id="forceConversionTable" units="N:1, kN:1e-3, lbf:0.2248" style="color: blue; font-family:serif; font-size:large;"></div>

This element is created in the same way as above, with the first line loading the converter and the second specifying its format. Again, see the documentation on our main site.


Posted

in

by

Tags: