模仿语音输入效果


   
   

   
   
详细病情 (支持语音输入识别)
's

语音输入病情

.fill-case dl:last-child, .fill-text dl { border-bottom: none; } .fill-text dl dt{ padding: 15px 0 10px; font-size: 1.6rem; } .fill-text dl dt span { color: #fe4847; font-size: 1.2rem; } .fill-text dl dd { position: relative; } .fill-text dl dd .tape { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 30px; } .fill-text dl dd .tape .hear { width: 171px; height: 24px; margin-top: 6px; display: none; background: url(../images/bg/icon_doctor_yuyinshuru.png) center center no-repeat; background-size: 100% 100%; position: relative; color: #fff; font-size: 1.2rem; line-height: 24px; } .fill-text dl dd .tape .hear b { font-weight: 400; padding-left: 30px; } .fill-text dl dd .tape .hear i { width: 14px; height: 14px; display: inline-block; background: url(../images/bg/icon_doctor_shangchuyuyin.png) center center no-repeat; background-size: 100% 100%; position: absolute; right: -24px; top: 5px; } .fill-text dl dd .tape .say { width: 30px; height: 30px; float: right; display: inline-block; background: url(../images/bg/icon_doctor_shurubingq.png) center center no-repeat; background-size: 100% 100%; } .fill-text dl dd textarea { width: 100%; height: 140px; vertical-align: top; border: 1px solid #dcdcdc; border-radius: 2px; padding: 10px 10px 50px; line-height: 21px; font-size: 1.4rem; } /* 录音弹窗 */ .sound-recording { width: 150px; height: 143px; position: fixed; top: 50%; left: 50%; padding: 20px; margin-top: -71px; margin-left: -75px; background: rgba(0,0,0,.3); border-radius: 5px; display: none; } .sound-recording dl { width: 100%; font-size: 0; } .sound-recording dl i { width: 50px; height: 73px; display: inline-block; background: url(../images/bg/icon_home_speak.png) center center no-repeat; background-size: 100% 100%; } .sound-recording dl dt { width: 50%; display: inline-block; } .sound-recording dl dd { width: 50%; display: inline-block; padding-left: 10px; text-align: right; } .sound-recording dl dd span { max-width: 48px; background: #fff; display: block; margin-top: 10px; height: 2px; border-radius: 2px; } .sound-recording p { width: 100%; text-align: center; font-size: 1.2rem; color: #fffefe; padding-top: 15px; } //语音识别 var timeout = undefined; //定时器 var state = 0; //状态 var lastTime = null; //最后时间 var nowTime = null; //开始时间 $("#talk_btn").on("touchstart", function (event) { lastTime = new Date().getTime(); //创建时间 event.preventDefault();//阻止触摸时浏览器的缩放、滚动条滚动 //span的width随机变化 setInterval(function (){ $(".sound-recording dd span").each(function (){ $(this).width(48*Math.random() + 'px'); }); },200) clearTimeout(timeout); state = 0; timeout = setTimeout(function() { state = 1; }, 1000); $(".sound-recording").show();//显示录音 }); $("#talk_btn").on("touchend", function (event) { event.preventDefault();//阻止触摸时浏览器的缩放、滚动条滚动 $(".sound-recording").hide();//关闭录音 $("#hear").css("display","inline-block"); clearTimeout(timeout); state = 0; nowTime = new Date().getTime(); var timeLength = ((nowTime-lastTime)/1000).toFixed(1); //时间差 $("#hear b").text(timeLength); }); $("#hear i").on("click", function (){ $(this).parent().hide(); })

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

曲线人

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值