我想在背景图片上使用链接(参见示例 http://goo.gl/GfkD6M )。如何添加指向该图片的部分(例如形状)的链接,如文本“Link1”和“Link 2”所示?
最佳答案
你不能那样做,但有几种方法可以间接地做到这一点:
1.您可以使用分离图像。
2.在图片上放一个索引比图片低的div
.getclick_link1 {
/* Get the position and width of Link1 with F12 in Chrome */
z-index : <put a z-index for the image> - 1;
width : <the width of Link1> ;
height : <the height of Link1>;
position : absolute;
left : <Get the left position of Link1 in the image>;
top : <Get the top position of Link1 in the image>;
}
在 JQuery 中这样做:
$(function(){
$(".getclick_link1").click(function() {
window.location = "The address you like to redirect"
});
});
关于html - 背景图片上的链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31317741/