Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Add example code to demo page
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Attardi committed Oct 12, 2019
1 parent 1d44e0b commit 0fb556e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,22 @@
<h1>Emoji Button</h1>
<input type="text">
<button id="emoji-button">😀</button>

<code>
<pre>
window.addEventListener('DOMContentLoaded', () => {
const button = document.querySelector('#emoji-button');
const picker = new EmojiButton();

picker.on('emoji', emoji => {
document.querySelector('input').value += emoji;
});

button.addEventListener('click', () => {
picker.pickerVisible ? picker.hidePicker() : picker.showPicker(button);
});
});
</pre>
</code>
</body>
</html>

0 comments on commit 0fb556e

Please sign in to comment.