gpt4 book ai didi

javascript - 如何使 PDF 中的图像在新的弹出窗口中打开其链接?

转载 作者:行者123 更新时间:2023-11-30 15:17:07 25 4
gpt4 key购买 nike

我正在 HTML 中嵌入 PDF。有一些带有 PDF 链接的图像。我想让这些链接在弹出窗口/新窗口中打开,而不是在点击时在新/相同的选项卡中打开。

最佳答案

如果目标属性不适合您,您可以在 JS/jQuery 中执行此操作

   return function(el) {
el.find('a').on('click', function(e) {
e.preventDefault();
var i = $(this).attr('class');
var u = this.href;
var c = {h:370, w:550};
var xPos = ($(window).width()-c.w)/2;
var n = window.open(u,i,'height='+c.h+',width='+c.w+',left='+xPos+',top=60,screenX='+xPos+',screenY=60');
if (window.focus) { n.focus(); }
});
};

关于javascript - 如何使 PDF 中的图像在新的弹出窗口中打开其链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44302072/

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