How to center image in the specific div according to current viewport position?

前端 未结 5 2104
时光说笑
时光说笑 2021-02-14 20:37

I am trying create nice animation during loading content using ajax. I want to use display icon during reloading div with \"Content\", however I can\'t figured out is it possibl

5条回答
  •  星月不相逢
    2021-02-14 20:55

    .loading #img_loading {
        position: fixed;
        top: 50%;
        left: calc(50% + 55px);
        display: block;
    }
    

    The above will solve the half of the problem, you need to update the left dynamically with javascript.

提交回复
热议问题