簡體   English   中英

如何在Chrome中實現抓取光標圖標?

[英]How can you implement a grabbing cursor icon in Chrome?

我知道可以在Chrome中使用抓取光標圖標(當然是在Gmail中),但我無法弄清楚如何在我的代碼中實現它。 我試過(在CSS中):

body {
  cursor: grab;
}

body {
  cursor: -webkit-grab;
}


body {
  cursor: url(http://www.worldtimzone.com/mozilla/testcase/css3cursors_files/grab.gif);
}

Chrome在“抓取”名稱之前需要-webkit-;

下面是一個適用於Chrome和Mozilla的樣式示例,其中包括當您“保持”某些內容時光標的更改。

#eA { cursor: -webkit-grab; cursor:-moz-grab; }
#eA:active { cursor: -webkit-grabbing; cursor:-moz-grabbing;}

參考: https//developer.mozilla.org/en-US/docs/Web/CSS/cursor

因此,在CSS中,您可以從基礎開始,然后轉向更加模糊的內容。 瀏覽器將選擇適用於該特定瀏覽器的最后一個。 無論出於何種原因,Chrome支持webkit-grab但不支持抓取。

body {
  cursor: pointer;
  cursor: hand;
  cursor: -webkit-grab;
  cursor: grab;
}

關於您關於操作此操作的能力的后續問題,請嘗試使用以下內容:

document.body.style.cursor = 'move';

這是gmail使用的樣式,如果這是你想要的精確光標樣式:

body {
  cursor: url(https://ssl.gstatic.com/ui/v1/icons/mail/images/2/openhand.cur), default !important;
}

你可以在這里測試一下

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM