Zone de commentaire HTML avec émoticônes. Les émoticônes sont chargées via les données Json et vous pouvez modifier les émoticônes selon vos propres préférences. Le code de cette zone de commentaire est du code HTML, CSS et JQ. La figure 1 montre l'état d'origine et la figure 2 montre la liste des expressions qui apparaît lorsque vous cliquez sur l'expression. Vous pouvez en sélectionner une ou plusieurs à volonté. Jetons un coup d'œil au code implémenté.
Photo 1
Photo 2
Code implémenté :
code html :
Code XML/HTMLCopier le contenu dans le presse-papiers
- <div classe="Principal" >
-
<div class="Input_Box" >
-
<textarea class="Input_text" >textarea>
-
<div classe="faceDiv" > div>
-
<div class="Input_Foot" > <une classe="imgBtn" href="javascript:void(0);"> ;a><a classe="postBtn">OKa > div>
-
div>
-
div>
code css3 :
Code CSS
Copier le contenu dans le presse-papiers
Code Javascript :
Code JavaScript
Copier le contenu dans le presse-papiers
- var ImgIputHandler={
- facePath :[
-
{faceName:"smile",facePath:"0_smile.gif"},
- {FACENAME : "🎜> , Facepath : " 1_ 撇 撇 .gif " >
{faceName:
"色"-
,facePath:"2_色.gif"},
{FACENAME : "Duke"
- , Facepath : "3_ Duke .gif" },
{faceName:"Deyi"
- ,facePath:"4_Deyi.gif"},
{FACENAME : "Larmes"
, FacePath : - "5_ 泪 泪 .gif" },
{faceName:"timide"
,facePath:-
"6_shy.gif"},
{faceName:"Tais-toi"
, facePath:-
"7_Shut up.gif"},
{faceName:"pleurer"
, facePath:-
"9_crying.gif"},
{faceName:"Gênant"
,facePath:-
"10_awkward.gif"},
{faceName:"en colère"
,facePath:-
"11_angry.gif"},
{FACENAME : "Vilain" , FacePath :
- "12_ 皮 .gif" },
{faceName:"Barteeth",facePath:
- "13_Bargain.gif"},
{faceName:"surprise",facePath:
- "14_surprise.gif"},
{faceName:"triste",facePath:
- "15_sad.gif"},
{faceName:"Cool",facePath:
- "16_cool.gif"},
{faceName:"Sueur froide",facePath:
- "17_Sueur froide.gif"}, >
{faceName:"Crazy",facePath:
"18_Crazy.gif"- },
-
{faceName:"vomit",facePath:"19_vomit.gif"},
- {FACENAME : "Souriant" , FacePath : "20_linking .gif" },
- {faceName:"mignon",facePath:"21_cute.gif"},
- {faceName:"Yeux blancs",facePath:"22_Yeux blancs.gif"},
- {faceName:"arrogance",facePath:"23_arrogance.gif"},
- {faceName:"faim",facePath:"24_hunger.gif"},
- {faceName:"trapped",facePath:"25_trapped.gif"},
- {faceName:"Horreur",facePath:"26_Horror.gif"},
- {faceName:"sueur", facePath:"27_sweat.gif"},
{FACENAME : - "憨" , facepath : "28_ 憨 笑 .gif" },
{faceName:-
"GI",facePath:"29_GI.gif"},
{faceName:-
"struggle",facePath:"30_struggle.gif"},
{faceName:-
"cuss",facePath:"31_curse.gif"},
{faceName:-
"question",facePath:"32_question.gif"},
{faceName:-
"Sh",facePath:"33_boo.gif"},
{faceName:-
"halo",facePath:"34_halo.gif"},
{faceName:-
"torture",facePath:"35_torture.gif"},
{FACENAME :
- "décliner" , FacePath : "36_ 衰 .gif" },
{faceName :
- "Squelette",facePath :"37_skeleton.gif"},
- {FACENAME : "Appuyez" , Facepath : "38_ hit .gif" },
- {faceName:"Au revoir",facePath:"39_Goodbye.gif"},
- {faceName:"wipe sweat", facePath:"40_wipe sweat.gif"},
-
{faceName:
- "se curer le nez", facePath:"41_se curer le nez.gif"},
{faceName:
- "Applaudissements",facePath:"42_Applause.gif"},
{faceName:
- "Je suis tellement gêné", facePath:"43_Je suis gêné.gif" },
{faceName:
- "mauvais sourire", facePath:"44_bad smile.gif"},
{faceName:
- "Zuo Hengheng", facePath:"45_left Hengheng.gif" },
{ faceName :
- "Right Heng Heng", facePath :"46_Right Heng Heng.gif" },
{faceName:
- "Bâillement",facePath:"47_yawn.gif"},
{faceName:
- "Mépris",facePath:"48_Contempt.gif"},
{faceName:
- "Deuil",facePath:"49_Grief.gif"},
{faceName:
- "Je suis sur le point de pleurer", facePath:"50_Je suis sur le point de pleurer.gif" },
{faceName:
- "insidious",facePath:"51_insidious.gif"},
{faceName:
- "Kiss", facePath:"52_Kiss.gif"},
{FACENAME :
"Peur" - , Facepath : "53_ <.gif> },
{faceName:
"Pauvre"-
,facePath:"54_Poor.gif"},
{faceName:
"Chop Knife"-
,facePath:"55_Chop Knife.gif"},
{faceName:
"Pastèque"-
,facePath:"56_watermelon.gif"},
-
{faceName:"Bière",facePath:"57_beer.gif"},
-
{faceName:"Basketball",facePath:"58_basketball.gif"},
-
{faceName:"pingpong",facePath:"59_pingpong.gif"},
-
{faceName:"Câlin",facePath:"78_hug.gif"},
-
{faceName:"Handshake",facePath:"81_Handshake.gif"},
-
{faceName:"sourire suffisant", facePath:"sourire suffisant.gif"},
-
{faceName:"Écouter de la musique",facePath:"Écouter de la musique.gif"}
- ]
- , ,
-
Init :fonction(){
-
var isShowImg=false;
-
$(".Input_text").focusout(fonction(){
-
$(this).parent().css("border-color", "#cccccc");
$(-
this).parent().css("box-shadow", "aucun");
$(-
this).parent().css("-moz-box-shadow", "aucun");
$(
ce-
).parent().css("-webkit-box-shadow", "aucun");
});
-
$().Input_text").focus(fonction(){
-
$(this).parent().css("border-color", "rgba(19,105,172,.75)");
-
$(this).parent().css("box-shadow", "0 0 3px rgba(19,105,192,.5)");
-
$(this).parent().css("-moz-box-shadow", "0 0 3px rgba(241,39,232,.5)");
-
$(this).parent().css("-webkit-box-shadow", "0 0 3px rgba(19,105,252,3)");
- });
-
$(".imgBtn").cliquez(fonction(){
-
if(isShowImg==false){
-
isShowImg=true;
-
$(this).parent().prev().animate({marginTop:"-125px"},300);
-
if($(".faceDiv").children().length==0){
-
pour(var i=0;i
- $(".faceDiv").append(" ImgIputHandler. facePath[i].faceName "" src="face/" ImgIputHandler.facePath[i].facePath "" />");
- }
-
$(".faceDiv>img").click(fonction(){
-
-
isShowImg=false;
-
$(this).parent().animate({marginTop:"0px"},300 );
-
ImgIputHandler.insertAtCursor($(".Input_text")[0],"[" $( ce).attr("titre") "]");
- } );
- }
-
}autre{
-
isShowImg=false;
-
$(this).parent().prev().animate({marginTop:"0px"},300 );
- }
- });
-
$().postBtn").click(fonction(){
-
alerte($().Input_text").val());
- });
- },
-
insertAtCursor :fonction(myField, myValue) {
-
si (document.selection) {
- myField.focus();
- sel = document.selection.createRange();
- sel.text = myValue ;
- sel.select();
-
} else if (myField.selectionStart || myField.selectionStart == "0") {
-
var startPos = myField.selectionStart;
-
var endPos = myField.selectionEnd;
-
var restoreTop = myField.scrollTop;
- myField.value = myField.value.substring(0, startPos) myValue myField.value.substring(endPos, myField.value.length);
-
if (restoreTop > 0) {
- myField.scrollTop = restoreTop ;
- }
- myField.focus();
- myField.selectionStart = startPos myValue.length;
- myField.selectionEnd = startPos myValue.length;
-
} autre {
- myField.value = myValue ;
- myField.focus();
- }
- }
- }