侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

jqueryFace表情包使用

2024-05-13 星期一 / 0 评论 / 0 点赞 / 103 阅读 / 1920 字

实现如上图所示的效果 首先下载jquery.qqFace.js与jquery-browser.js 需要修改表情包显示的位置可以在jquery.qqFace.js中修改var top = offset

实现如上图所示的效果

首先下载jquery.qqFace.js与jquery-browser.js

需要修改表情包显示的位置可以在jquery.qqFace.js中修改var top = offset.top + $(this).outerHeight();

html中的textara改成<div class="text" style="background: #c0c0c0;height: 120px;" contenteditable="true" id="textarea"></div> 

jquery.qqFace.js中修改insertAtCaret函数中else里面的值为textFeildValue = textFeildValue.replace(//</g,'&lt;');
            textFeildValue = textFeildValue.replace(//>/g,'&gt;');
            textFeildValue = textFeildValue.replace(//n/g,'<br/>');
            textFeildValue = textFeildValue.replace(//[em_([0-9]*)/]/g,'<img src="static/arclist/$1.gif" border="0" />');
            textObj.innerHTML+=textFeildValue; 

最后在提交的时候修改replace_em函数为function replace_em(str){
            /* str = str.replace(//</g,'&lt;');
            str = str.replace(//>/g,'&gt;');
             */str = str.replace(//n/g,'<br/>');
            str = str.replace(//[em_([0-9]*)/]/g,'<img src="static/arclist/$1.gif" border="0" />');
            return str;
        }

最后大功告成,不知道这样改会不会出现什么问题,但是目前使用良好。

广告 广告

评论区