How to avoid blinking when updating page from ajax

前端 未结 2 1613
梦如初夏
梦如初夏 2021-01-01 02:33

I\'ve got a table with a header, a row with input fields, rows with data. Like this. http://brow.hu/sitegen/stackoverflow_table_example.png

If somebody enters someth

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-01 03:14

    One way to avoid flicker is called double-buffering. In Ajax, this can be done simply with 2 divs occupying the same space, one of them with the style 'display: none', the other 'display: inline'. Always write to the invisible one, and then swap display styles. If the divs have absolute positioning and size, there is absolutely no chance for flicker, and even if they don't, you can hardly do better.

提交回复
热议问题