SVG游标没有响应标签

时间:2017-10-28 19:25:38

标签: javascript svg cursor

我已经创建了一个自定义SVG游标,并且无法响应链接。您可以从下面的示例中看到,您无法打开链接

https://codepen.io/anon/pen/dZymZK

$(document).mousemove(function(e) {
  $(".custom-cursor").position({
    my: "center center",
    of: e,
    collision: "fit"
  });
});
:root {
     cursor: url(http://chrishawkins.us/blank.cur), none;
}

.custom-cursor {
  position: absolute;
  cursor: none;
}
a:hover {
 cursor:pointer !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<svg id="pointer" height="50" width="50">
  <polygon points="1,1 49,10 20,20 10,49"> 
    <!-- coordinates are in x,y format -->
    <!-- points go clockwise around the polygon -->
</svg>
  
  
  <a href="bbc.co.uk" target="_blank">bbc</a>

1 个答案:

答案 0 :(得分:1)

请将以下属性提供给选择器#pointer:

position: relative;

它应该有用。