• <i id='AXVmV'><tr id='AXVmV'><dt id='AXVmV'><q id='AXVmV'><span id='AXVmV'><b id='AXVmV'><form id='AXVmV'><ins id='AXVmV'></ins><ul id='AXVmV'></ul><sub id='AXVmV'></sub></form><legend id='AXVmV'></legend><bdo id='AXVmV'><pre id='AXVmV'><center id='AXVmV'></center></pre></bdo></b><th id='AXVmV'></th></span></q></dt></tr></i><div id='AXVmV'><tfoot id='AXVmV'></tfoot><dl id='AXVmV'><fieldset id='AXVmV'></fieldset></dl></div>
    <tfoot id='AXVmV'></tfoot>

        • <bdo id='AXVmV'></bdo><ul id='AXVmV'></ul>

        <small id='AXVmV'></small><noframes id='AXVmV'>

        <legend id='AXVmV'><style id='AXVmV'><dir id='AXVmV'><q id='AXVmV'></q></dir></style></legend>
      1. 将 Font Awesome 图标设置为光标 - 这可能吗?

        Set Font Awesome icons as cursor - is this possible?(将 Font Awesome 图标设置为光标 - 这可能吗?)
        <i id='H7I0A'><tr id='H7I0A'><dt id='H7I0A'><q id='H7I0A'><span id='H7I0A'><b id='H7I0A'><form id='H7I0A'><ins id='H7I0A'></ins><ul id='H7I0A'></ul><sub id='H7I0A'></sub></form><legend id='H7I0A'></legend><bdo id='H7I0A'><pre id='H7I0A'><center id='H7I0A'></center></pre></bdo></b><th id='H7I0A'></th></span></q></dt></tr></i><div id='H7I0A'><tfoot id='H7I0A'></tfoot><dl id='H7I0A'><fieldset id='H7I0A'></fieldset></dl></div>
          <tbody id='H7I0A'></tbody>
        <legend id='H7I0A'><style id='H7I0A'><dir id='H7I0A'><q id='H7I0A'></q></dir></style></legend>

        <small id='H7I0A'></small><noframes id='H7I0A'>

          • <bdo id='H7I0A'></bdo><ul id='H7I0A'></ul>

                1. <tfoot id='H7I0A'></tfoot>

                2. 本文介绍了将 Font Awesome 图标设置为光标 - 这可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  Font Awesome 有一个非常好的图标集合,可用于 Web 项目.我想使用其中一个图标作为光标(自定义光标).

                  Font Awesome has a very good collection of icons to be used in web projects. I want to use one of those icons as cursor (custom cursor).

                  据我了解,自定义光标需要一个图片网址,但我无法找到 Font Awesome 图标的图片网址.

                  In my understanding, Custom Cursors need an image url, but I am unable to find the image urls for Font Awesome icons.

                  推荐答案

                  知道了!

                  1. 创建画布
                  2. 在上面画上fa图标
                  3. 改成base-64的图片url
                  4. 在光标css样式上应用图片

                  我做了一个演示:http://jsfiddle.net/rqq8B/2/

                  // http://stackoverflow.com/questions/13761472/how-to-render-glyphs-from-fontawesome-on-a-canvas-element
                  // http://stackoverflow.com/questions/13932291/css-cursor-using-data-uri
                  
                  $(function() {
                      var canvas = document.createElement("canvas");
                      canvas.width = 24;
                      canvas.height = 24;
                      //document.body.appendChild(canvas);
                      var ctx = canvas.getContext("2d");
                      ctx.fillStyle = "#000000";
                      ctx.font = "24px FontAwesome";
                      ctx.textAlign = "center";
                      ctx.textBaseline = "middle";
                      ctx.fillText("uf002", 12, 12);
                      var dataURL = canvas.toDataURL('image/png')
                      $('body').css('cursor', 'url('+dataURL+'), auto');
                  });

                  body {
                      position: fixed;
                      left: 0;
                      right: 0;
                      top: 0;
                      bottom: 0;
                  }

                  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>

                  这篇关于将 Font Awesome 图标设置为光标 - 这可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to make rooftext effect and valley text effect in HTML5 (or Fabric.js)(如何在 HTML5(或 Fabric.js)中制作屋顶文字效果和山谷文字效果)
                  Draw border around nontransparent part of image on canvas(在画布上的图像不透明部分周围绘制边框)
                  dragging and resizing an image on html5 canvas(在 html5 画布上拖动图像并调整其大小)
                  What#39;s the difference between a boolean as primitive and a boolean as property of an object?(作为原始对象的布尔值和作为对象属性的布尔值有什么区别?)
                  I want to do animation of an object along a particular path(我想沿特定路径对对象进行动画处理)
                  How to upload image into HTML5 canvas(如何将图像上传到 HTML5 画布中)
                  • <legend id='hHaWR'><style id='hHaWR'><dir id='hHaWR'><q id='hHaWR'></q></dir></style></legend>

                          <tbody id='hHaWR'></tbody>

                          <tfoot id='hHaWR'></tfoot>
                          • <bdo id='hHaWR'></bdo><ul id='hHaWR'></ul>

                            <small id='hHaWR'></small><noframes id='hHaWR'>

                          • <i id='hHaWR'><tr id='hHaWR'><dt id='hHaWR'><q id='hHaWR'><span id='hHaWR'><b id='hHaWR'><form id='hHaWR'><ins id='hHaWR'></ins><ul id='hHaWR'></ul><sub id='hHaWR'></sub></form><legend id='hHaWR'></legend><bdo id='hHaWR'><pre id='hHaWR'><center id='hHaWR'></center></pre></bdo></b><th id='hHaWR'></th></span></q></dt></tr></i><div id='hHaWR'><tfoot id='hHaWR'></tfoot><dl id='hHaWR'><fieldset id='hHaWR'></fieldset></dl></div>