문제

I'm using the Ajax updateprogress and I attached a loading gif, the problem is that how can i force the loading.gif to be in the center of the screen even if your in the very bottom / top of the page? is there a way to make it appear in the center always? I want the user to see the loading gif in the center always for them to be notified that the page is still loading..

.CenterPB
    {
        position: absolute;
        left: 50%;
        top: 50%;
        margin-top: -20px; /* make this half your image/element height */
        margin-left: -20px; /* make this half your image/element width */
        width:auto;
        height:auto;
    }

   <asp:UpdateProgress ID="UpdateProgress1" runat="server" DynamicLayout="false">
    <ProgressTemplate>
        <div class="CenterPB" style="height: 40px; width: 40px;">
            <asp:Image ID="Image1" runat="server" ImageUrl="~/App_Themes/Default/images/progressbar1.gif"
                Height="35px" Width="35px" />
            Loading ...
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>

Thanks!

도움이 되었습니까?

해결책

I'm assuming you want it stay put in the middle, even when scrolling. Then you would have to change:

    position: absolute;

in

    position: fixed;

다른 팁

position: fixed; should do the trick, that way the loading image will stay fixed to the browser window so if the user scrolls the image will stay centered to the browser, not the page.

demo: http://jsbin.com/ifimek/edit#javascript,html,live (try scrolling obviously)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top