具有嵌套效果循环的jquery动画
16lz
2021-01-22
I have a nested function to show/hide paragraphs news-ticker-style.
我有一个嵌套函数来显示/隐藏段落news-ticker-style。
The problem is that when the loop starts over (line 4), the opacity effects stop working correctly so the paragraphs appear abruptly.
问题是,当循环重新开始时(第4行),不透明效果会停止正常工作,因此段落会突然出现。
Any jquery masters know about this? Am I making this too hard?
任何jquery大师都知道这个吗?我这太难了吗?
$('#special-ticker p').hide();
var a=0;
function outer() {
function inner() {
if(a===$('#special-ticker p').length) { a = 0; }
$('#special-ticker p').
eq(a).
fadeIn(800, function(){
$(this).animate({opacity:100},10000,null,function(){
$(this).hide(800,function(){
a++;
outer();
});
});
});
}
return inner();
}
$(function(){
outer();
});
4 个解决方案
#1
5
the problem is line 9:
问题是第9行:
$(this).animate({opacity:100},10000,null,function(){
//...
opacity should be "1" (opacity is a value between 0 and 1)
不透明度应为“1”(不透明度为0到1之间的值)
$(this).animate({ opacity : 1 }, 10000, null, function() {
更多相关文章
- 9.1.4 前端 - HTML body标签 - 标题,段落,分割线,换行,特殊符号,列
- 段落包括通过过渡带来的div
- 【WEB基础】HTML & CSS 基础入门(3)段落及文本
- 视差滚动与图像仅通过徽标透明度
- 动态更改angularjs中静态段落的颜色
- Python Module之textwrap - 文本段落格式编排