在 asp.net MVC 中加载 Gif 的正确方法
我正在尝试找到一种正确加载 gif 的方法...显然我现在的做法会导致页面上出现混合内容警告。我尝试过使用 Url.Content(~/path/to/javascript/file) 和 ResolveClient(~/doesn't/work/either)...我能做些什么来规避此警告?我将向您展示我的代码+我收到的警告...
function DemoSearchInternals()
{
//debugger;
var form = $("#DemoGraphID");
$div = $("#TabView1");
var srlzdform = form.serialize();
var PopID = <% =PopID %>;
var options = [];
var $url = $("#target").attr("action");
//getSize();
$('<div id="overlay">').css({
position: 'absolute',
opacity: 0.2,
top : $div.offset().top,
left : $div.offset().left,
width : $div.width(),
height : $div.outerHeight(),
background: 'grey url(<%=ResolveClientUrl("~/images/indicator_web20_working.gif")%>) no-repeat center'
}).hide().appendTo($div);//Url.Content("~/images/indicator_web20_working.gif")
$("#overlay").fadeIn();
$.post('<%:Url.Action("SearchByDemographic", "PatientACO")%>', srlzdform, function (data)
{
DisplayDemographicSearch(data);
$("#overlay").fadeOut('slow', function () {
$("#overlay").remove();
});
});
}
我特别关心背景部分?在 asp.net MVC2 应用程序中,这是调用 url 的最佳方式吗?本节:
background: 'grey url(<%=Url.Content("~/images/indicator_web20_working.gif")%>) no-repeat center'
您看到哪里写着灰色 url(yadda yadd) 我正确调用了 Url 吗?有更好的调用方式吗?
I am trying to find a way to correctly load a gif... Apparently the way I am doing it now is causing a mixed content warning on the page. I have tried using Url.Content(~/path/to/javascript/file) and ResolveClient(~/doesn't/work/either)... What can I do to circumvent this warning? I will show you my code + the warning I get...
function DemoSearchInternals()
{
//debugger;
var form = $("#DemoGraphID");
$div = $("#TabView1");
var srlzdform = form.serialize();
var PopID = <% =PopID %>;
var options = [];
var $url = $("#target").attr("action");
//getSize();
$('<div id="overlay">').css({
position: 'absolute',
opacity: 0.2,
top : $div.offset().top,
left : $div.offset().left,
width : $div.width(),
height : $div.outerHeight(),
background: 'grey url(<%=ResolveClientUrl("~/images/indicator_web20_working.gif")%>) no-repeat center'
}).hide().appendTo($div);//Url.Content("~/images/indicator_web20_working.gif")
$("#overlay").fadeIn();
$.post('<%:Url.Action("SearchByDemographic", "PatientACO")%>', srlzdform, function (data)
{
DisplayDemographicSearch(data);
$("#overlay").fadeOut('slow', function () {
$("#overlay").remove();
});
});
}
I am particularly concerned about the background section? In an asp.net MVC2 app, is that the best way to call url? This section:
background: 'grey url(<%=Url.Content("~/images/indicator_web20_working.gif")%>) no-repeat center'
You see where it says grey url(yadda yadd) am I calling Url correctly? Is there a better way to call it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论