gpt4 book ai didi

asp.net-mvc - Ajax.ActionLink 加载具有背景不透明度的图像定位

转载 作者:行者123 更新时间:2023-12-02 07:25:03 25 4
gpt4 key购买 nike

当我单击 ajax.action 链接时,我想在页面中间显示加载图像,背景不透明。

<img id="image_loading" alt="" src="../../images/site/loading.gif" style="position: fixed;     
display: none;" />

这是我的代码

<nav class="ust_menu">
<ul>
<li>@Ajax.ActionLink("Home", "Index", "Home", new AjaxOptions { UpdateTargetId = "article_site", LoadingElementId = "image_loading" })</li>
<li>@Ajax.ActionLink("Contact Us", "Contact", "Home", new AjaxOptions { UpdateTargetId = "article_site", LoadingElementId = "image_loading" })</li>
<li>@Ajax.ActionLink("About", "About", "Home", new AjaxOptions { UpdateTargetId = "article_site", LoadingElementId = "image_loading" })</li>
</ul>
</nav>

我可以显示没有背景不透明度的图像,而不是我想要的位置。如何在页面中间显示背景不透明的加载图像。

谢谢。

最佳答案

将图像居中:

<img id="image_loading" alt="" src="@Url.Content("~/content/loading.gif")" class="progress" />

在 CSS 文件中:

.progress {
display: none;
position: fixed;
top: 50%;
left : 50%;
margin-top: -50px;
margin-left: -100px;
}

现在,如果您想做一些更奇特的效果,您可以订阅 OnBeginOnComplete 回调,这样您就可以更好地控制图像的显示方式:

@Ajax.ActionLink("Home", "Index", "Home", new AjaxOptions { 
OnBegin = "onBegin",
OnComplete = "onComplete",
UpdateTargetId = "article_site"
})

然后:

function onBegin() {
// TODO: show the progress image
}

function onComplete() {
// TODO: hide the progress image
}

关于asp.net-mvc - Ajax.ActionLink 加载具有背景不透明度的图像定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10003504/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com