链接内的链接? [英] link within a link?
本文介绍了链接内的链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的html中使用 iframe
,加载我从网上找到的图片库。每个 img
都有一个您可以点击的信息栏,当栏打开时,它为观众提供了更多信息。
< a href =images / test.jpg>
data-big =
data-title =test title
data-description =test description />
< / a>
我想在 data-description
元素位于一个链接的图像中,但我不知道这是否可能,如果是这样,如何?
解决方案
.link {
position:relative;
}
.link span {
position:absolute;
}
< a class =linkhref =http://cnn.com>
< img src =http://placehold.it/150x100data-big =data-title =test titledata-description =test description/>
< span data-url =http://npr.org>其他连结< / span>
< / a>
$('。link span')。click(function(e){
e.preventDefault();
window.location = $(this).attr(' data-url');
});
请注意,我在本例中使用了jQuery。
i'm using an iframe
within my html, loading an image gallery i found from the web. Each img
has an information bar you can click on, and when the bar opens it provides viewers with additional info.
<a href="images/test.jpg">
<img src="images/test.jpg",
data-big=""
data-title="test title"
data-description="test description"/>
</a>
i would like to insert another link in the data-description
element that sits within a linked image, but i don't know if this is possible and if so, how?
解决方案
.link {
position: relative;
}
.link span {
position: absolute;
}
<a class="link" href="http://cnn.com">
<img src="http://placehold.it/150x100" data-big="" data-title="test title" data-description="test description"/>
<span data-url="http://npr.org">Other link</span>
</a>
$('.link span').click(function (e) {
e.preventDefault();
window.location = $(this).attr('data-url');
});
Note that I used jQuery for this example.
这篇关于链接内的链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文