Place the mouse pointer over the wick
to put on the fire and click to blow it out.
In my last post I designed a Christmas tree so I felt like making another thing related to Christmas.
This time it is a Christmas candle which you can lit and blow out. The fire and the candle parts are created by div elements. We want to lit the fire when we roll over the candle wick with the mouse. This is done by the mouseover event inside the HTML code.
Now, we want that the candle glimmers in the dark so we use jQuery because with it it's easy to write a code for animated effects. The glimmer effect is created by changing the opacity of the div fire element with the following syntax animate( {opacity:"+= or -= some number between 0 to 1"},{duration:milliseconds});. "+=" creates a fade in effect and "-=" a fade out effect.
By clicking the fire, the candle should stop glimmering. We put the onclick event inside the HTML code and connect it with the function called blow(). jQuery hide() hides the fire element.
to put on the fire and click to blow it out.
In my last post I designed a Christmas tree so I felt like making another thing related to Christmas.
This time it is a Christmas candle which you can lit and blow out. The fire and the candle parts are created by div elements. We want to lit the fire when we roll over the candle wick with the mouse. This is done by the mouseover event inside the HTML code.
Now, we want that the candle glimmers in the dark so we use jQuery because with it it's easy to write a code for animated effects. The glimmer effect is created by changing the opacity of the div fire element with the following syntax animate( {opacity:"+= or -= some number between 0 to 1"},{duration:milliseconds});. "+=" creates a fade in effect and "-=" a fade out effect.
By clicking the fire, the candle should stop glimmering. We put the onclick event inside the HTML code and connect it with the function called blow(). jQuery hide() hides the fire element.