Skip to content

dyerc/jQuery-Font-Chooser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage

<div id="fontSelect" class="fontSelect">
	<div class="arrow-down"></div>
</div>

To turn the above into a font selector dropdown:

$('#fontSelect').fontSelector({
		'hide_fallbacks' : true,
		'initial' : 'Courier New,Courier New,Courier,monospace',
		'selected' : function(style) { alert(style); },
		'opened' : function(style) { alert('opened'); },
		'closed' : function(style) { alert('closed'); },
		'fonts' : [
			'Arial,Arial,Helvetica,sans-serif',
			'Arial Black,Arial Black,Gadget,sans-serif',
			'Comic Sans MS,Comic Sans MS,cursive',
			'Courier New,Courier New,Courier,monospace',
			'Georgia,Georgia,serif',
			'Impact,Charcoal,sans-serif',
			'Lucida Console,Monaco,monospace',
			'Lucida Sans Unicode,Lucida Grande,sans-serif',
			'Palatino Linotype,Book Antiqua,Palatino,serif',
			'Tahoma,Geneva,sans-serif',
			'Times New Roman,Times,serif',
			'Trebuchet MS,Helvetica,sans-serif',
			'Verdana,Geneva,sans-serif',
			'Gill Sans,Geneva,sans-serif'
			]
	});

The hide_fallbacks option, when true, prevents the full font stack specified in the ul from being outputted. Instead only the first font name will be shown, the full font stack will be used specified in the css though. The function passed to selected will be called whenever a new font is selected, the first argument is the full font stack. The inital font is the font be initially shown in the dropdown.

About

A custom combo box to allow font selection from a preset list, whilst previewing the font

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published