HTML部分:

<div class="tab-pane fade dialog-record" id="dialogRecord">
<volist name="dialogRecord" id="record">
<div class="dialog">
<span class="time">{$record.time}</span>
<span class="text">{$record.asr}</span>
<div class="dialog-container">
<div class="audio-animation">
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
<div id="four"></div>
</div>
</div>
<audio class="audio">
<source src="{$record.audition_url}"/>
</audio>
<div class="focus" tabindex =></div>
</div>
</volist>
</div>

css部分:

.dialog-record .dialog span.text{
max-width: %;
height: auto;
background: #0094DE;
padding-left: 3.5%;
padding-right: 3.5%;
padding-top: 8px;
padding-bottom: 8px;
font-size: .3rem;
color: #fff;
line-height: 25px;
border-radius: 5px;
margin-left: 7px;
display: inline-block;
margin-right: %;
}
.dialog-record .dialog span.time{
display: block;
width: %;
text-align: center;
margin-bottom: 5px;
color: #;
}
.dialog-record .dialog .focus{
height: 5px;
outline-style: none;
}
/*播放语音时的动画*/
@keyframes yuying{
%{
height: %;
}
%{
height: %;
}
%{
height: %;
}
%{
height: %;
}
%{
height: %;
}
} .dialog-container{
width: 40px;
height: 40px;
border: 2px solid #0094de;
border-radius: 8px;
display: inline-flex;
justify-content: center;
align-items: center;
}
.dialog-container .audio-animation{
width: 20px;
height: 20px;
}
.audioPlay #one{
animation:yuying .6s infinite .15s;
-webkit-animation:yuying .6s infinite .15s;
}
.audioPlay #two{
animation:yuying .6s infinite .3s;
-webkit-animation:yuying .6s infinite .3s;
}
.audioPlay #three{
animation:yuying .6s infinite .45s;
-webkit-animation:yuying .6s infinite .45s;
}
.audioPlay #four{
animation:yuying .6s infinite .6s;
-webkit-animation:yuying .6s infinite .6s;
} #one,#two,#three,#four{
width:2px;
border-radius: 50px;
background-color: #0094de;
vertical-align: middle;
display: inline-block;
}
#one{
margin-left: 1px;
height: %;
}
#two{
height: %;
}
#three{
height: %;
}
#four{
height: %;
}

JS部分:

        //播放语音
$('#dialogRecord').on('click','.dialog-container',function(){
var currentNode = $(this);
var audioEle = $(this).siblings('.audio');
playAudio(currentNode,audioEle);
});
function playAudio(currentNode,audioEle){
/*jquery对象转换成js对象*/
var player = audioEle[];
if (player.paused){ /*如果已经暂停*/
player.play(); /*播放*/
currentNode.children('.audio-animation').addClass('audioPlay');
currentNode.parent().siblings().children('.dialog-container').find('.audio-animation').removeClass('audioPlay');
}else {
player.pause();/*暂停*/
currentNode.children('.audio-animation').removeClass('audioPlay');
}
// 录音播放结束停止动画
player.addEventListener('ended', function () {
currentNode.children('.audio-animation').removeClass('audioPlay');
}, false);
}

最新文章

  1. js 实现进度条功能。
  2. IOS开发-影院选座算法 限制产生孤座
  3. caffe学习系列(2):训练和测试自己的图片
  4. 【python】An Introduction to Interactive Programming in Python(week two)
  5. dede在线留言
  6. 释放C盘空间的27招优化技巧
  7. cocos2dx中的场景和使用方法
  8. C#多线程(上) 分类: C# 线程 2015-03-09 10:35 174人阅读 评论(0) 收藏
  9. sphinx(coreseek)——1、增量索引
  10. Hacker(三)之黑客定位目标---IP
  11. 字符串聚合技术(String Aggregation Techniques)
  12. hdu 4965 Fast Matrix Calculation(矩阵高速幂)
  13. css背景图片、隐藏、指针、垂直居中、去除下划线、缩进、列表类型
  14. 静态频繁子图挖掘算法用于动态网络——gSpan算法研究
  15. [BZOJ1087] [SCOI2005] 互不侵犯King (状压dp)
  16. pslq常用操作
  17. 启用shopt 选项实现不使用 CD 命令进入目录/文件夹
  18. 【转载】网站服务器运维记实:阿里云1核2G突发性能t5服务器突然变得卡顿
  19. Django之get请求url的参数
  20. SpringMVC源码分析(3)DispatcherServlet的请求处理流程

热门文章

  1. php7静态方法的链式调用
  2. HTTP协议详解(一)
  3. [MySQL]group by 与 if 的统计技巧
  4. Codeforces 848C Goodbye Souvenir [CDQ分治,二维数点]
  5. 注册InstallShield
  6. 什么是java序列化,如何实现java 序列化?
  7. 'mysql' 不是内部或外部命令,也不是可运行的程序或批处理文件
  8. 数据库技术丛书:SQL Server 2016 从入门到实战(视频教学版) PDF
  9. ionic3 更新打开apk android 8.0报错
  10. 断路器Feign