I want to create a temperature slider which will change the color of the div(s) based on their melting and boiling points. These values are stored in the following array
var elements = {
hydrogen: {"m_point": "14.01", "b_point": "20.28"},
helium: {"m_point": "0", "b_point": "4.22"},
//----------so on----------------------------
};
and these are the divs whose colors have to be changed
<div id="hydrogen"><em>1</em>H<p>Hydrogen</p></div>
<div id="helium"><em>2</em>He<p>Helium</p></div>
<!---------so on----------------------------------->
I can't figure out how can I use the value returned by the slider, compare that value with the melting/boiling points given, and change color of div according to that(e.g blue if value>=m_point, red if value>=b_point
etc.). Basically change color when the state of elements will change from solid->liquid, liquid->gas and vice-versa. I can't use if else statements as I have to specify color each and every time for each element.