Comments (2)
This is just one way of doing it.
You can add the proper image style on top of your template:
<style>
img.emoji {
height: 1em;
width: 1em;
margin: 0 .05em 0 .1em;
vertical-align: -0.1em;
}
</style>
Plus the twemoji library
<script src="//twemoji.maxcdn.com/twemoji.min.js"></script>
And at the bottom of the template, where there are usually other scripts, you can:
<script>
(function (div) {
for (var i = 0, re = /\bblog-posts\b/; i < div.length; i++) {
if (re.test(div[i].className)) {
twemoji.parse(div[i]);
}
}
}(document.getElementsByTagName('div')));
// it could be faster and simpler via
// document.querySelectorAll('.blog-posts')
// but I wanted to avoid errors with older browsers
</script>
This should replace all emoji chars in your posts with images, by default 36x36 png.
However, you need to be able to write emoji in your posts, using as example a compatible mobile device, since this project is about reading with emoji, and not writing them.
It would be awesome to have a plugin based on twemoji
able to let anyone include them in any textarea. Maybe coming soon from third parts?
Hope this helped.
from twemoji.
great example :) like it
from twemoji.
Related Issues (20)
- Emoji of the Brazilian flag is not as consistent as that of the flag of the United States. HOT 4
- bring back twemoji to mobile devices
- FEAT: Improve the ui of footer in the website
- FEAT: Improve the ui of footer in the websit HOT 1
- Fluent Emoji: Twemoji drop-in replacement HOT 3
- about using twemoji HOT 1
- New CDN doesn't seem to work HOT 2
- CDN not needed HOT 1
- Where is the donkey, goose, jellyfish and moose? HOT 10
- How to use twemoji for input field HOT 2
- Grey heart emoji (1FA76.svg) is barely differentiable from the white heart emoji (1F90D.svg)
- Update flag of Martinique HOT 2
- Attribution
- I want to make a Chinese translation HOT 3
- Blue heart (1f499) is different shade than other blue emojis such as blue square, circle, etc. HOT 2
- ![sweating-nervous](https://user-images.githubusercontent.com/2575182/211350030-249c6b1f-a347-4ade-bd40-1ed83629f09f.gif) HOT 1
- Old Twitter Logo (the bird) still not updated (to the X) in twitter.com/account/access HOT 2
- twemoji website doesnt work HOT 2
- CDN links to maxcdn.com are broken HOT 3
- Question: Commercial offline & online usage
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twemoji.