Dot dotdot dotdotdot as loading?

前端 未结 8 2170
借酒劲吻你
借酒劲吻你 2021-01-31 07:43

I wanna create some loading dots, like this:

At 0000 miliseconds the span content is: .

At 0100 miliseconds the span content is: ..

8条回答
  •  情话喂你
    2021-01-31 08:13

    let span = document.querySelector('span');
        i = 0;
    
    setInterval(() => {
        span.innerText = Array(i = i > 2 ? 0 : i + 1).fill('.').join('');
    }, 500)
    

提交回复
热议问题