j查询文本滑块动画
jQuery text slider animation
我发现了这个很酷的脚本:
http://puaction.com/testimonials/
我想用jQuery制作完全相同的脚本吗?
这是我的出发点
http://jsfiddle.net/5p79oevx/
.html:
<div id="testimonials">
<div class="testimonial">
"Text text text text text text text text text text text text text text text text text text text text text text text text text text text text " - <span>Person</span>
</div>
<div class="testimonial">
"Text text text text text text text text text text text text text text text text text text text text text text text text text text text text " - <span>Person</span>
</div>
<div class="testimonial">
"Text text text text text text text text text text text text text text text text text text text text text text text text text text text text " - <span>Person</span>
</div>
<div class="testimonial">
"Text text text text text text text text text text text text text text text text text text text text text text text text text text text text " - <span>Person</span>
</div>
</div>
.css:
#testimonials
{
width:200px;
height:200px;
}
.testimonial span
{
color:red;
}
谢谢!
这里是 JSFiddle。
此代码使用 Jquery UI:
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
.JS:
function roll(){
var curr = 2;
var count = 4;
$('#testimonials .testimonial:nth-child(1)').show("slide", { direction: "down" }, 500);
setInterval(function(){
//console.log('C:'+curr);
$('#testimonials .testimonial').hide("slide", { direction: "up" }, 500);
$('#testimonials .testimonial:nth-child('+curr+')').delay(750).show("slide", { direction: "down" }, 500);
curr++;
if(curr == count+1){
// 5000 - 500 - 750 - 500 = 3250 => delay = 3000
$('#testimonials .testimonial:nth-child(4)').delay(3000).hide("slide", { direction: "up" }, 500);
curr = 1;
}
}, 5000);
}
.CSS:
#testimonials
{
width:200px;
height:200px;
max-height: 200px;
}
.testimonial
{
display: none;
}
.testimonial span
{
color:red;
}
相关文章:
- 动画文本淡入淡出
- 创建一致的简单横幅文本动画
- 悬停在动画文本上后,文本淡入淡出不会返回
- 动画文本阴影以淡入淡出
- css3动画文本居中对齐
- 如何将鼠标悬停在文本/图像上时触发动画文本
- 用于演示的表单字段中的动画文本输入
- 带jquery的动画文本切换
- 是否有一种方法来动画文本区域的不透明度与jQuery
- 动画文本滑动和替换为另一个文本使用jquery
- 动画文本颜色jQuery CSS悬停消失
- CSS动画文本不工作
- 如何用渐变颜色动画文本
- 动画文本慢慢地在列表中
- rapha 235;l:尝试将半动画文本添加到旋转器图形中
- 动画文本,循环通过数组的单词和颜色
- 动画文本区域,以适应文本区域的内容
- 我如何阻止Javascript动画文本重复
- 如何在D3中动画文本锚
- JQuery动画文本