Font-based CSS emoticons set
Font-based CSS emoticons set
Do you like Font Awesome Icons? You gotta love Font Wonderful Emoticons!
<link rel="stylesheet" type="text/css" media="all" href="https://cdn.staticaly.com/gh/DamianoPantani/fw-emoticons/v0.9/dist/fw_emoticons.css">
You can also download the repo, and just link fw_emoticons.css
in your HTML.
<ANY class="fw EMO_TYPE EMO_NAME"></ANY>
EMO_TYPEs of the current version:
fw-o
- Default font outlinedfw-s
- Sketchy fontfw-f
- Today I Feel fontfw-m
- Memes fontExamples:
<i class="fw perky"></i>
<i class="fw fw-o perky"></i>
<span class="fw fw-s pain"></span>
The most common attributes you may want to customize are:
transform: scaleX(-1); /* Flip horizontally */
text-shadow: 0 0 1px rgba(0,0,0,0.15); /* make 'em smooth! */
vertical-align: middle;
font-size: 22px;
color: red;
Animations are perfect supplementation for this component. It’s nicely working with Animate.css framework, but you can also use out of the box ones:
fw-shake
fw-spin
fw-rotate
fw-updown
fw-bounce
Instead of modifying css sheet to your needs you can add these classes respectively:
fw-100ms
, fw-200ms
… fw-3000ms
fw-d1s
, fw-d2s
… fw-d10s
fw-rep-1
, fw-rep-2
… fw-rep-10
fw-reverse
To replace existing smileys in your page (e.q. :)
, :-(
, :D
) with fw-emoticons, link this js:
<script src="https://cdn.staticaly.com/gh/DamianoPantani/fw-emoticons/v0.9/dist/fw_emoticons.js"></script>
Then invoke new Emoticons().replace()
function. Example:
new Emoticons().replace({
selector: '.comments, .about-me > .text', // REQUIRED. CSS rule where to look for smileys
mainClass: 'fw-o', // OPTIONAL. Type of emoticons
emoTag: 'i', // OPTIONAL. HTML tag of emoticons
emoMap: { // OPTIONAL. Modify default mappings. Values can be either strings or string arrays
'smile': ':)',
'happy': ':D',
'sad': [':(', ';(', ':sad:']
}
});
var emoticons = new Emoticons({'happy': ':D'}); // If you want to modify default mapping - for even better performance pass it once in constructor.
emoticons.replace({selector: '.aDiv'});
emoticons.replace({selector: '.bDiv'});
.comment, .comment p
. It may skip child blocks and cause a slight performance drop in extreme cases. Instead, in this example run the replace
function twice, or wrap existing text from .comment
block in any html tag.FW-Emoticons is a Freeware component, but it uses third-party font faces. Please refer to the section below for more license details.
Any considerations? Problems? Upgrade ideas? Please raise an issue. Thank you!