Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple font-pickers #1

Closed
kiogo opened this issue Feb 3, 2018 · 3 comments
Closed

Multiple font-pickers #1

kiogo opened this issue Feb 3, 2018 · 3 comments

Comments

@kiogo
Copy link

kiogo commented Feb 3, 2018

Hello, what would be the best method to have multiple font-pickers?

@samuelmeuli
Copy link
Owner

Unfortunately, it is currently only possible to have one font picker. I will look into it though and keep you updated.

@samuelmeuli
Copy link
Owner

I just added the option to have multiple font pickers on the same site.

For them to work, you need to give both font pickers a name, and then use these names in the respective divs where the font pickers should be generated, and also in the class names where the fonts should be applied to.

Here's an example:

<div id="font-picker-1"></div>
<div id="font-picker-2"></div>

<p class="apply-font-1">Text in font 1</p>
<p class="apply-font-2">Text in font 2</p>

<script type="text/javascript" src="./path/to/dist/index.js"></script>
<script type="text/javascript">
	const fontPicker1 = new FontPicker(
		'YOUR_API_KEY',
		'Open Sans',
		{ name: '1' }
	);
	const fontPicker2 = new FontPicker(
		'YOUR_API_KEY',
		'Roboto',
		{ name: '2' }
	);
	fontPicker1.init();
	fontPicker2.init();
</script>

Hope this helps :)

samuelmeuli added a commit to samuelmeuli/font-picker-react that referenced this issue Feb 3, 2018
@kiogo
Copy link
Author

kiogo commented Feb 6, 2018

Works great, thanks for the update!

@kiogo kiogo closed this as completed Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants