我有以下 HTML 模板:
<div class='item'>
<img href='...' attributes='...' \>
<div class='popup' attributes='...'>
</div>
</div>
我使用 Jquery 将鼠标悬停在 div(以及图像)上,并显示弹出窗口。问题是,我似乎无法控制+单击以在 chrome 或 firefox 的新选项卡中打开;我也不能右键单击图像并在新选项卡中打开链接。我怎样才能做到这一点?
添加target="_blank"到链接。它应该看起来像这样:
<div class='item'>
<a href='...' target="_blank"><img src='....' attributes='...' \></a>
<div class='popup' attributes='...'>
</div>
</div>
您希望图像打开的链接进入,图像a href='LINK'的文件路径进入img src='PATH'
这是带有图像示例的代码标记(ctrl+单击它,它将带您到 google.com):
<div class="item">
<a href="http://www.google.com">
<img src="https://www.google.com/intl/en_ALL/images/logos/images_logo_lg.gif" attributes="#"\>
</a>
<div class="popup" attributes="#">
</div>
</div>
你只需<img>要用标签包装你的<a>标签。
希望能帮助到你!
所有你需要的是
<div class='item' >
<a href='...' attributes='...' target="_parent">
<img src="yoursource.jpg"/></a>
<div class='popup' attributes='...'>
</div>
</div>
添加 target="_parent" 或者您可以在您的 href 中使用 _blank(并暂时删除 img),然后使用 > 关闭 href 并生成新的 img 字段。用现在应该可以工作的方式包装你的 href 和 img
用标签包围您的图像<a>并链接到包含该图像的新页面。