javascript - 在调查仪表板中弹出图像
问题描述
我正在设置一个调查仪表板,并希望能够单击图像以在另一个窗口中打开。这可以正常工作,但是如果我单击多个图像,我会打开许多不同的窗口。有没有办法让它在我单击新图像时关闭窗口并打开新窗口?
我可以在单独的新窗口中打开图像。
代码如下所示:
<a href="javascript:void(0)" onclick="$(this).next('div').clone().dialog({width:550,height:640});"><img src="image1.jpg" width="100" height="100" align="right"/></a><div style="display:none;"><img src="image1.jpg" style="max-width:500px;max-height:500px;"></img></div>
<a href="javascript:void(0)" onclick="$(this).next('div').clone().dialog({width:550,height:640});"><img src="image2.jpg" width="100" height="100" align="right"/></a><div style="display:none;"><img src="image2.jpg" style="max-width:500px;max-height:500px;"></img></div>
<a href="javascript:void(0)" onclick="$(this).next('div').clone().dialog({width:550,height:640});"><img src="image3.jpg" width="100" height="100" align="right"/></a><div style="display:none;"><img src="image3.jpg" style="max-width:500px;max-height:500px;"></img></div>
<a href="javascript:void(0)" onclick="$(this).next('div').clone().dialog({width:550,height:640});"><img src="image4.jpg" width="100" height="100" align="right"/></a><div style="display:none;"><img src="image4.jpg" style="max-width:500px;max-height:500px;"></img></div>
当您打开新图像或让新图像替换旧图像时,希望关闭一个图像窗口。
解决方案
不可以。创建一个新窗口后,当您单击另一个图像时,您将无法关闭它。这是不可能的。
您可以在同一窗口中显示图像,而不是创建新窗口。
请尝试以下方法。
推荐阅读
- vue.js - Vuejs/Buetify:使用 b-table 的可搜索道具清除搜索过滤器
- android - 如何从 Firebase 数据库中检索图像 url
- html - 是图像文件问题还是大小问题?HTML CSS 背景图片问题
- javascript - React 中的隐藏输入/文本区域值 onChange setState - 无需用户输入输入
- ag-grid - 在服务器 API 上排序后如何在客户端上禁用排序?
- azure - 缩小 Azure SQL Server 权限
- apache-spark - 对于相同的数据总量,来自多个 parquet 文件的 SparkSQL 查询比单个 parquet 慢得多
- angular - 无法在 IIS 默认网站内使用 Angular 托管 ASP .NET core 3.1
- python - 在 Dash 中实现一个控制台,该控制台会根据服务器上的中间步骤的状态进行更新
- regex - 正则表达式匹配两个字符之间的特殊字符