Why doesn't Progress Bar dynamically change unlike Text?

后端 未结 6 1637
無奈伤痛
無奈伤痛 2021-02-07 06:56

I\'m dynamically updating a few elements after a setTimeout() function. The jQuery function .text() seems to dynamically update with each change of ind

6条回答
  •  遇见更好的自我
    2021-02-07 07:23

    This is probably a redraw issue. Since the delay is set to 0 the CSS changes aren't drawn until the last update.

    The easiest way to force a redraw is to read the elements height:

    $("div[role='progressbar']").css("width", markerPer + "%").attr("aria-valuenow", markerPer);
    $("div[role='progressbar']").height();
    

提交回复
热议问题