Giter Site home page Giter Site logo

smiley's Introduction

Smiley

A simple emoticon picker using jquery Demo

To add the emoticon picker download the repository, upload smiley.css and smiley.js to your server, and add <link rel="stylesheet" type="text/css" href="css/smiley.css"> in your <head> then either add <script scr="scripts/smiley.js"></script> or add

<script>
//http://character-code.com/emoticons-html-codes.php
var s_name = ["grinning face", "grinning face with smiling eyes", "face with tears of joy", "smiling face with open mouth", "smiling face with open mouth and smiling eyes", "smiling face with open mouth and cold sweat", "smiling face with open mouth and tightly-closed eyes", "smiling face with halo", "smiling face with horns", "winking face", "smiling face with smiling eyes", "face savouring delicious food", "relieved face", "smiling face with heart-shaped eyes", "smiling face with sunglasses", "smirking face", "neutral face", "expressionless face", "unamused face", "face with cold sweat", "pensive face", "confused face", "confounded face", "kissing face", "face throwing a kiss", "kissing face with smiling eyes", "kissing face with closed eyes", "face with stuck-out tongue", "face with stuck-out tongue and winking eye", "face with stuck-out tongue and tightly-closed eyes", "disappointed face", "worried face", "angry face", "pouting face", "crying face", "persevering face", "face with look of triumph", "disappointed but relieved face", "frowning face with open mouth", "anguished face", "fearful face", "weary face", "sleepy face", "tired face", "grimacing face", "loudly crying face", "face with open mouth", "hushed face", "face with open mouth and cold sweat", "face screaming in fear", "astonished face", "flushed face", "sleeping face", "dizzy face", "face without mouth", "face with medical mask", "grinning cat face with smiling eyes", "cat face with tears of joy", "smiling cat face with open mouth", "smiling cat face with heart-shaped eyes", "cat face with wry smile", "kissing cat face with closed eyes", "pouting cat face", "crying cat face", "weary cat face", "face with no good gesture", "face with ok gesture", "person bowing deeply", "see-no-evil monkey", "hear-no-evil monkey", "speak-no-evil monkey", "happy person raising one hand", "person raising both hands in celebration", "person frowning", "person with pouting face", "person with folded hands"];


$(".smiley-button").click(function() {
 if ($(".smiley-picker").hasClass("hidden")) {
   $(".smiley-picker").fadeIn("fast");
   $(".smiley-picker").toggleClass("hidden");
 } else {
   $(".smiley-picker").fadeOut("fast");
   $(".smiley-picker").toggleClass("hidden");
 }
});
var sm = 0*1;

for (i = 128512; i < 128577; i++) {
   $(".smiley-picker").append("<button type='button' title='"+s_name[sm]+"'  value='&#"+i+"' class='smiley'>&#"+i+"</button>");
   sm = (sm + 1)*1;
}
for (i = 128581; i < 128591; i++) {
   $(".smiley-picker").append("<button type='button' title='"+s_name[sm]+"'  value='&#"+i+"' class='smiley'>&#"+i+"</button>");
   sm = (sm + 1)*1;
}
$(document).ready(function() {
   $(document).on("click",".smiley",function(){
 	$(".smiley-input").val($('.smiley-input').val()+$(this).text());
 })
})
</script>

In your <textarea> or <input> add class="smiley-input" and below the <textarea> add

<button type="button" class="smiley-button">
 &#128512
</button>
<div class="smiley-picker hidden">
</div>

add your own css and classes to make it look better. Please report any issues.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.