Skip to content
This repository has been archived by the owner. It is now read-only.
A font selector for the Google Web Fonts api
Branch: master
Clone or download
tommoor Merge pull request #13 from rossp/master
Remove http: links; now works on both http & SSL pages.
Latest commit d72f132 Feb 22, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Remove http: links; now works on both http & SSL pages Aug 19, 2014
.gitignore Added gitignore, added missing semicolons, merged default value Jun 11, 2012
README.md Added license info Dec 19, 2012
fontselect.css Removed unused css definition Aug 18, 2011
fs-sprite.png
jquery.fontselect.js Remove http: links; now works on both http & SSL pages Aug 19, 2014
jquery.fontselect.min.js

README.md

Fontselect jQuery Plugin

A font selector to choose from fonts available as part of the Google Web Fonts api.

Let users easily select and preview a font from Google's large range of free fonts.

Documentation

To create a font selector simply run the plugin on a standard html input element.

How to use

    $('input.fonts').fontselect();

Options

Fontselect has one argument, an options object that you might want to customise:

  • style: the class to give the new font selector

  • placeholder: text to use when no font is selected yet

  • lookahead: a number of fonts to try and preload ahead in the select box

      $('input.fonts').fontselect({
        style: 'font-select',
        placeholder: 'Select a font',
        lookahead: 2
      });
    

Events

Fontselect triggers the change event on the original element when a font is selected. An example is included to show how this could be used to update the font on the current page.

    $('input.fonts').fontselect().change(function(){
    
      // replace + signs with spaces for css
      var font = $(this).val().replace(/\+/g, ' ');
      
      // log font name
      console.log(font);
    });

License / Credits

This plugin is released under the MIT license. It is simple and easy to understand and places almost no restrictions on what you can do with the code. More Information

Download

Releases are available for download from GitHub.

You can’t perform that action at this time.