A fix for firefox - although firefox doesn't seem to pass an AnimationEvent object
into the event, which makes it less reliable.