jwarby / jquery-awesome-cursor

jQuery plugin for using FontAwesome icons as custom CSS cursors
https://jwarby.github.io/jquery-awesome-cursor/
MIT License
179 stars 69 forks source link

Allow a different font to be used #8

Closed jwarby closed 9 years ago

jwarby commented 9 years ago

This feature would allow a font other than FontAwesome to be used. This is desirable for a number of reasons:

This feature should be fairly easy to implement; there are two main changes that need to be addressed:

  1. change the hard-coded font string to reference an option instead
  2. allow a way to specify the CSS class for icon. For instance, FontAwesome icons require the class .fa fa-<icon name>.

Suggested approach is thus:

It may also be worth wrapping both of these new options in an object since they are so closely related:

  $(...).awesomeCursor('some-icon', {
    font: {
      name: 'MyAmazingIconFont',
      cssClass: 'fa fa-%s'
    }
  });

However this is implemented, it will default to the usual FontAwesome-specific values. and will of course be overridable:

  console.log($.fn.awesomeCursor.defaults);
  // ...
  // font: {
  //   name: 'FontAwesome',
  //   cssClass: 'fa fa-%s'   
  // }
  // ...