【问题标题】:SVG cursor not responding to a tagsSVG 光标不响应标签
【发布时间】:2017-10-29 03:37:15
【问题描述】:

我创建了一个自定义 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>

【问题讨论】:

    标签: javascript svg cursor


    【解决方案1】:

    请将以下属性赋予选择器#pointer:

    position: relative;
    

    它应该可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-26
      • 1970-01-01
      • 2020-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多