objectivehtml / FlipClock

http://flipclockjs.com/
MIT License
2.74k stars 954 forks source link

Setting Clockface Option after Clockface is Created #77

Closed LucyintheSkyWithDiamonds closed 10 years ago

LucyintheSkyWithDiamonds commented 10 years ago

Hello, this is a fantastic library, but I am having trouble changing the clockface to 'MinuteCounter' using the setOption command.

My relevant code:

$(document).ready(function() { clock = $('.clock').FlipClock(100, { clockFace: 'HourCounter', countdown: true }); clock.setTime(timesdatanext); //variable set elsewhere setInterval(function() { if (getTimes().next >= 39600 && getTimes().next <= 43200) //conditional based on variable set elsewhere { $("#update").html("The update is happening right now and will continue for about:"); $("#update2").html("And the next update will start in:"); clock.setOption('clockFace', 'MinuteCounter'); clock2.setOption('clockFace', 'MinuteCounter');//second clock, not created in this excerpt clock.setTime(getTimes().next - 39600); clock2.setTime(getTimes().next);
} // else statement below not included

// clock.setOption('clockFace', 'MinuteCounter') does not work?

What is the best way to accomplish this change to the MinuteCounter based on conditionals evaluated after the clockface has been created?

Thank you! :)

objectivehtml commented 10 years ago

This is now possible in the latest build. There is an example in the repo called load-new-clock-face.html that will illustrate this.