Html 在内容丰富的页面中,让ajax加载程序始终可见

Html 在内容丰富的页面中,让ajax加载程序始终可见,html,css,ajax,Html,Css,Ajax,我有一个div作为AJAXloader“image”的函数。这是纯css。 我遇到的问题是,页面有很多内容,如果你在页面下方的某个位置,你将看不到加载程序,因为它显示在页面顶部的某个位置(看不见) 我需要更改什么: <div id="floatingBarsG" style="display: none; position: absolute; top: 50%; left: 50%; padding: 2px; z-index: 99999"> <div class=

我有一个
div
作为
AJAX
loader“image”的函数。这是纯css。 我遇到的问题是,页面有很多内容,如果你在页面下方的某个位置,你将看不到加载程序,因为它显示在页面顶部的某个位置(看不见)

我需要更改什么:

<div id="floatingBarsG" style="display: none; position: absolute; top: 50%; left: 50%; padding: 2px; z-index: 99999">
    <div class="blockG" id="rotateG_01">
    </div>
    <div class="blockG" id="rotateG_02">
    </div>
    <div class="blockG" id="rotateG_03">
    </div>
    <div class="blockG" id="rotateG_04">
    </div>
    <div class="blockG" id="rotateG_05">
    </div>
    <div class="blockG" id="rotateG_06">
    </div>
    <div class="blockG" id="rotateG_07">
    </div>
    <div class="blockG" id="rotateG_08">
    </div>
</div>

尝试了各种
margin
选项,但均无效。

尝试以下方法:

#floatingBarsG
{
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
试试这个:

#floatingBarsG
{
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
试试这个:

#floatingBarsG
{
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
试试这个:

#floatingBarsG
{
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

在这里,您的加载器不会位于div的中心。请参阅:

#floatingBarsG {
    width:30px;
    height:16px;
    position:fixed;
    top:50%;
    margin-top:-8px; */half of your loader height*/
    left:50%;
    margin-left:-15px; */half of your loader width*/
    */this will help you that the loader be at the center of your div and it is fixed there.*/
}

在这里,您的加载器不会位于div的中心。请参阅:

#floatingBarsG {
    width:30px;
    height:16px;
    position:fixed;
    top:50%;
    margin-top:-8px; */half of your loader height*/
    left:50%;
    margin-left:-15px; */half of your loader width*/
    */this will help you that the loader be at the center of your div and it is fixed there.*/
}

在这里,您的加载器不会位于div的中心。请参阅:

#floatingBarsG {
    width:30px;
    height:16px;
    position:fixed;
    top:50%;
    margin-top:-8px; */half of your loader height*/
    left:50%;
    margin-left:-15px; */half of your loader width*/
    */this will help you that the loader be at the center of your div and it is fixed there.*/
}

在这里,您的加载器不会位于div的中心。请参阅:

#floatingBarsG {
    width:30px;
    height:16px;
    position:fixed;
    top:50%;
    margin-top:-8px; */half of your loader height*/
    left:50%;
    margin-left:-15px; */half of your loader width*/
    */this will help you that the loader be at the center of your div and it is fixed there.*/
}


请考虑用小提琴来解释你的问题。但是,您是否查看过CSS属性position:fixed?页面样式的信息不多,但您能否将加载程序放在带有position:fixed的页脚中,使其在页面底部始终可见。@ScottAlexander,无论用户的滚动条在何处,加载程序都应可见。此外,我有超过1 Ajax调用在不同的“点”(顶部/中间/底部/和介于两者之间)在网站上。请考虑做一个小提琴()来解释你的问题。但是,您是否查看过CSS属性position:fixed?页面样式的信息不多,但您能否将加载程序放在带有position:fixed的页脚中,使其在页面底部始终可见。@ScottAlexander,无论用户的滚动条在何处,加载程序都应可见。此外,我有超过1 Ajax调用在不同的“点”(顶部/中间/底部/和介于两者之间)在网站上。请考虑做一个小提琴()来解释你的问题。但是,您是否查看过CSS属性position:fixed?页面样式的信息不多,但您能否将加载程序放在带有position:fixed的页脚中,使其在页面底部始终可见。@ScottAlexander,无论用户的滚动条在何处,加载程序都应可见。此外,我有超过1 Ajax调用在不同的“点”(顶部/中间/底部/和介于两者之间)在网站上。请考虑做一个小提琴()来解释你的问题。但是,您是否查看过CSS属性position:fixed?页面样式的信息不多,但您能否将加载程序放在带有position:fixed的页脚中,使其在页面底部始终可见。@ScottAlexander,无论用户的滚动条在何处,加载程序都应可见。此外,我在不同的“点”(顶部/中部/底部/以及介于两者之间的任何点)上触发了不止一个AJAX调用在这个网站上,这会显示加载器吗?在页面的中间,这会显示加载器吗?在页面的中间,这会显示加载器吗?在页面的中间,这将显示加载器吗?在页面的中间。