I am trying to create a div with a css3 animated timer in it when a button is pressed. heres the code: http://jsfiddle.net/arcco96/y5nov6rz/1/. For some reason it will not create the div. I think the code should be functional but I am not sure whether or not one can create a div with a css animation after the page load.
My fiddle is based on this one: http://jsfiddle.net/zbGCq/118/.
I am creating the div with:
$("#btn1").click(function(){
jQuery('<div/>', {
class: 'timer',
}).appendTo('#center');
jQuery('<div/>', {
class: 'mask',
}).appendTo('#center');
});
Any thoughts?
thanks
p.s. on a slightly unrelated note will I be able to overlay content on the #timer or will that be impossible?
You were trying to jquery objects before they existed.
the css is still broken in my firefox, but the javascript is working,
It does something animated in chromium, I don't know if that's the effect you want or not.
http://jsfiddle.net/Lbuseo9j/
I would do this by animating
svg
'spath
element through JavaScript.You can set the
width
andheight
of the timer by changing thewidth
variable. You can also change the animation speed through thet
variable.Demo on CodePen