jquery.atwho实现输入框at用户和弹出表情选择输入效果代码

代码语言:html

所属分类:表单美化

代码描述:jquery.atwho实现输入框at用户和弹出表情选择输入效果代码,可以监听任何字符,不仅仅只是’@‘,可以设置监听不同的字符和使用不同的数据。

代码标签: at 用户 弹出 表情 选择 输入 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">

    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script>
    <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/jquery.atwho.css">
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.atwho.js"></script>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.caret.js"></script>
    <script type="text/javascript">
        $(function(){
            $.fn.atwho.debug = true
            var emojis = [
              "smile", "iphone", "girl", "smiley", "heart", "kiss", "copyright", "coffee",
              "a", "ab", "airplane", "alien", "ambulance", "angel", "anger", "angry",
              "arrow_forward", "arrow_left", "arrow_lower_left", "arrow_lower_right",
              "arrow_right", "arrow_up", "arrow_upper_left", "arrow_upper_right",
              "art", "astonished", "atm", "b", "baby", "baby_chick", "baby_symbol",
              "balloon", "bamboo", "bank", "barber", "baseball", "basketball", "bath",
              "bear", "beer", "beers", "beginner", "bell", "bento", "bike", "bikini",
              "bird", "birthday", "black_square", "blue_car", "blue_heart", "blush",
              "boar", "boat", "bomb", "book", "boot", "bouquet", "bow", "bowtie",
              "boy", "bread", "briefcase", "broken_heart", "bug", "bulb",
              "person_with_blond_hair", "phone", "pig", "pill", "pisces", "plus1",
              "point_down", "point_left", "point_right", "point_up", "point_up_2",
              "police_car", "poop", "post_office", "postbox", "pray", "princess",
              "punch", "purple_heart", "question", "rabbit", "racehorse", "radio",
              "up", "us", "v", "vhs", "vibration_mode", "virgo", "vs", "walking",
              "warning", "watermelon", "wave", "wc", "wedding", "whale", "wheelchair",
              "white_square", "wind_chime", "wink", "wink2", "wolf", "woman",
              "womans_hat", "womens", "x", "yellow_heart", "zap", "zzz", "+1",
              "-1"
            ]
            var jeremy = decodeURI("J%C3%A9r%C3%A9my") // Jérémy
            var names = ["Jacob","Isabella","Ethan","Emma","Michael","Olivia","Alexander","Sophia","William","Ava","Joshua","Emily","Daniel","Madison","Jayden","Abigail","Noah","Chloe","你好","你你你", jeremy, "가"];
        
            var names = $.map(names,function(value,i) {
              return {'id':i,'name':value,'email':value+"@email.com"};
            });
            var emojis = $.map(emojis, function(value, i) {return {key: value, name:value}});
        
            var at_config = {
              at: "@",
              data: names,
              headerTpl: '<div class="atwho-header">Member List<small>↑&nbsp;↓&nbsp;</small></div>',
              insertTpl: '${name}',
              displayTpl: "<li>${name} <small>${email}</small></li>",
              limit: 200
            }
            var emoji_config = {
              at: ":",
              data: emojis,
              displayTpl: "<li>${name} <img src='//repo.bfw.wiki/bfwrepo/icon/5e867b534398e.png'  height='20' width='20' /></li>",
              insertTpl: ':${key}:',
              delay: 400
            }
            $inputor = $('#inputor').atwho(at_config).atwho(emoji_config);
            $inputor.caret('pos', 47);
            $in.........完整代码请登录后点击上方下载按钮下载查看

网友评论0