[英]Adding link to image and target=“_blank”
我已经通过js添加了图片,但似乎无法弄清楚如何向该图片添加链接以及target =“ _ blank” ...这是我正在使用的代码:
$(function() {
$('body').delegate('.post-type-icon', 'click', function(){
var url = $(this).parents('.post-content').attr('data-url');
var newwindow = window.open('http://instagram.com?_url='+encodeURIComponent(url),'windowname','height=350,width=500');
});
});
现在,当您单击该图标时,带有此代码的链接未打开...不确定我在做什么错,任何帮助将不胜感激。 谢谢!
window.open用于打开弹出窗口,请尝试以下操作:
<a href='/someurl' target='_blank'>
<div id='yourimage'></div>
</a>
这样,如果他们单击您的图像,该图像包含在锚标记中,将导致在新标签页中打开一个窗口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.