jQuery评论框插入QQ表情特效代码下载



52 204 69



特效描述:jQuery 评论框插入 QQ表情,jQuery评论框插入QQ表情特效代码下载

代码结构

1. 引入JS

<script type="text/javascript" src="js/jquery.min.js"></script>

2. HTML代码

<div id="Demo" style="text-align:center;">
  <div class="Main">
    <div class="Input_Box">
      <textarea class="Input_text"></textarea>
      <div class="faceDiv"> </div>
      <div class="Input_Foot"> <a class="imgBtn" href="javascript:void(0);"></a><a class="postBtn">确定</a> </div>
    </div>
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(e) {
    ImgIputHandler.Init();
});
var ImgIputHandler={
	facePath:[
	    {faceName:"微笑",facePath:"0.gif"},
		{faceName:"撇嘴",facePath:"1.gif"},
		{faceName:"色",facePath:"2.gif"},
		{faceName:"发呆",facePath:"3.gif"},
		{faceName:"得意",facePath:"4.gif"},
		{faceName:"流泪",facePath:"5.gif"},
		{faceName:"害羞",facePath:"6.gif"},
		{faceName:"闭嘴",facePath:"7.gif"},
		{faceName:"大哭",facePath:"9.gif"},
		{faceName:"尴尬",facePath:"10.gif"},
		{faceName:"发怒",facePath:"11.gif"},
		{faceName:"调皮",facePath:"12.gif"},
		{faceName:"龇牙",facePath:"13.gif"},
		{faceName:"惊讶",facePath:"14.gif"},
		{faceName:"难过",facePath:"15.gif"},
		{faceName:"酷",facePath:"16.gif"},
		{faceName:"冷汗",facePath:"17.gif"},
		{faceName:"抓狂",facePath:"18.gif"},
		{faceName:"吐",facePath:"19.gif"},
		{faceName:"偷笑",facePath:"20.gif"},
	    {faceName:"可爱",facePath:"21.gif"},
		{faceName:"白眼",facePath:"22.gif"},
		{faceName:"傲慢",facePath:"23.gif"},
		{faceName:"饥饿",facePath:"24.gif"},
		{faceName:"困",facePath:"25.gif"},
		{faceName:"惊恐",facePath:"26.gif"},
		{faceName:"流汗",facePath:"27.gif"},
		{faceName:"憨笑",facePath:"28.gif"},
		{faceName:"大兵",facePath:"29.gif"},
		{faceName:"奋斗",facePath:"30.gif"},
		{faceName:"咒骂",facePath:"31.gif"},
		{faceName:"疑问",facePath:"32.gif"},
		{faceName:"嘘",facePath:"33.gif"},
		{faceName:"晕",facePath:"34.gif"},
		{faceName:"折磨",facePath:"35.gif"},
		{faceName:"衰",facePath:"36.gif"},
		{faceName:"骷髅",facePath:"37.gif"},
		{faceName:"敲打",facePath:"38.gif"},
		{faceName:"再见",facePath:"39.gif"},
		{faceName:"擦汗",facePath:"40.gif"},
		{faceName:"抠鼻",facePath:"41.gif"},
		{faceName:"鼓掌",facePath:"42.gif"},
		{faceName:"糗大了",facePath:"43.gif"},
		{faceName:"坏笑",facePath:"44.gif"},
		{faceName:"左哼哼",facePath:"45.gif"},
		{faceName:"右哼哼",facePath:"46.gif"},
		{faceName:"哈欠",facePath:"47.gif"},
		{faceName:"鄙视",facePath:"48.gif"},
		{faceName:"委屈",facePath:"49.gif"},
		{faceName:"快哭了",facePath:"50.gif"},
		{faceName:"阴险",facePath:"51.gif"},
		{faceName:"亲亲",facePath:"52.gif"},
		{faceName:"吓",facePath:"53.gif"},
		{faceName:"可怜",facePath:"54.gif"},
		{faceName:"菜刀",facePath:"55.gif"},
		{faceName:"西瓜",facePath:"56.gif"},
		{faceName:"啤酒",facePath:"57.gif"},
		{faceName:"篮球",facePath:"58.gif"},
		{faceName:"乒乓",facePath:"59.gif"},
		{faceName:"拥抱",facePath:"78.gif"},
		{faceName:"握手",facePath:"81.gif"},
	]
	,
	Init:function(){
		var isShowImg=false;
		$(".Input_text").focusout(function(){
			$(this).parent().css("border-color", "#cccccc");
            $(this).parent().css("box-shadow", "none");
            $(this).parent().css("-moz-box-shadow", "none");
            $(this).parent().css("-webkit-box-shadow", "none");
		});
		$(".Input_text").focus(function(){
		$(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").click(function(){
			if(isShowImg==false){
				isShowImg=true;
			    $(this).parent().prev().animate({marginTop:"-125px"},300);
				if($(".faceDiv").children().length==0){
					for(var i=0;i<ImgIputHandler.facePath.length;i++){
						$(".faceDiv").append("<img title=\""+ImgIputHandler.facePath[i].faceName+"\" src=\"face/"+ImgIputHandler.facePath[i].facePath+"\" />");
					}
					$(".faceDiv>img").click(function(){
				 		isShowImg=false;
			            $(this).parent().animate({marginTop:"0px"},300);
						ImgIputHandler.insertAtCursor($(".Input_text")[0],"["+$(this).attr("title")+"]");
					});
				}
			}else{
				isShowImg=false;
			    $(this).parent().prev().animate({marginTop:"0px"},300);
			}
		});
		$(".postBtn").click(function(){
			alert($(".Input_text").val());
		});
	},
	insertAtCursor:function(myField, myValue) {
    if (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;
    } else {
        myField.value += myValue;
        myField.focus();
    }
}
}
</script>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 瀑布流 收藏 预览 自适应页面大小 响应式区块列表布局 摇摆 烟花 清单样式 照相机 注释 下划线 结构图 鼠标悬停 条形码 弹幕 画板 朋友圈样式 红包 css绘制样式 支付 图文布局 右键菜单 图片头像上传 二维码 文字提示框 文件上传 地图 提示框/弹出层 文本框 计算器 layer 下拉框 计时器 lightbox 复选 桌面 单选 跳转 Tooltip工具提示框 登录框 步骤 浮动提示框 注册框 键盘 html5弹窗动画 搜索框 签到 验证码 分享 二级联动 点赞 投票 三级联动 雪花 城市选择 打印 value赋值 筛选 答题 按钮控制 购物车 震动 颜色选择 表单提交 全选/反选 图表 添加删除 鼠标滑过 添加标签 抽奖 密码强度验证 表情 表单验证 qq空间 头像截图 html5按钮动画 星星打分评分 按钮样式 密码修改设置 编辑器 播放器 电子杂志 排行榜 分页翻页 排序 表格隔行变色 table表格 进度条 多功能 弹出层拖动 窗口提示框 滑动星星打分 切换按钮 form表单 其他更多

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到