Html 将图像显示为同一窗口上的弹出窗口
这是我的第一个问题。请容忍我 我有一个表格,其中一列显示图像,而不是在表格的列中显示图像,当用户单击“查看图像”时,我想在同一窗口上更改为弹出图像。我尝试使用windows.open(imgSrc),新窗口弹出(我不想打开新窗口)和图像下载。我附上了我的一段代码。请帮帮我 身体 在表格列中显示图像的代码Html 将图像显示为同一窗口上的弹出窗口,html,css,angularjs,angular,angularjs-scope,Html,Css,Angularjs,Angular,Angularjs Scope,这是我的第一个问题。请容忍我 我有一个表格,其中一列显示图像,而不是在表格的列中显示图像,当用户单击“查看图像”时,我想在同一窗口上更改为弹出图像。我尝试使用windows.open(imgSrc),新窗口弹出(我不想打开新窗口)和图像下载。我附上了我的一段代码。请帮帮我 身体 在表格列中显示图像的代码 <td data-title='"Background Image"' header-class='text-left'><display-media model='Page.
<td data-title='"Background Image"' header-class='text-left'><display-media model='Page.Functions.GetBackgroundImageUrl(item)'></display-media></td>
您正在将图像传递到
窗口。打开将打开一个新的浏览器窗口,这就是它的工作,您正在寻找打开图像的模式
我建议尝试根据页面上的单图像模式示例修改代码。看起来您使用的是AngularJS。如果您也在使用引导,这个答案可能会有用
$scope.Page.Functions.GetBackgroundImageUrl = function (hero) {
if (hero && hero.BackgroundImageExist) {
var v = $scope.Page.Functions.GetDataVersion(hero.Id);
if (v) {
v = '?v=' + v;
}
window.open(ENV.apiUri + 'HomePageHero/BackgroundImage/' + hero.Id + v, "window Title", "width = 500, height = 450");
}
return null;
}
<td data-title='"Background Image"' header-class='text-left'><display-media model='Page.Functions.GetBackgroundImageUrl(item)'></display-media></td>
$scope.Page.Functions.GetHtmlText = function (rawText) {
return $sce.trustAsHtml(rawText);
}
$scope.Page.Functions.GetBackgroundImageUrl = function (hero) {
if (hero && hero.BackgroundImageExist) {
var v = $scope.Page.Functions.GetDataVersion(hero.Id);
if (v) {
v = '?v=' + v;
}
return 'imageUrl:' + ENV.apiUri + 'HomePageHero/BackgroundImage/' + hero.Id + v;
}
return null;
}