Javascript clock start

Associate
Joined
20 Apr 2004
Posts
1,745
Location
London
Hey guys, wondering if any of you boffins can make sense of this.

basically its a watch rotating and im having trouble getting it to start without pressing a link.

The original JS code is here

https://github.com/fofr/paulrhayes.com-experiments/blob/master/clock/js/experiment.js

One of the suggestions somebody else mentioned in another forum is the code below im not sure where to to put the 'true' value.

Code:
    // *******************************************************************
    //  here it starts based on if the url has #clock in its end
    //  a simple way is to change `window.location.hash === "#clock"` to `true`
    //  and it will start without a hash
    // *******************************************************************
    if(window.location.hash = true;) {
        startClock();
        $('p.start').remove();
    } else {
        $('#start').click(function() {
            startClock();
            $('p.start').remove();
        });
    }

Any help is appreciated,

Thanks!

R
 
Sorry the original code was

Code:
 if(window.location.hash === "#clock") {
        startClock();
        $('p.start').remove();
    } else {
        $('#start').click(function() {
            startClock();
            $('p.start').remove();
        });
    }

So your saying after the hash replace this entire syntax with 'startClock();' ?
 
It will use for it a HTML5 ad that might appear on various sites / tablets etc, so really, i cant see anyone looking at it for 10 mins...
 
Well, the animation needs to be triggered since it's a transition.

I've created a fiddle for you, which triggers the animation by adding a class. Note that the CSS has changed.

Fantastic mate, this works perfectly. Much appreciated. Just going to analyse the changed you made and try to understand it.

Regardless do you think i should be going another approach?

Now just need to ad a date!

R
 
Back
Top Bottom