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() {

更多相关文章

  1. 9.1.4 前端 - HTML body标签 - 标题,段落,分割线,换行,特殊符号,列
  2. 段落包括通过过渡带来的div
  3. 【WEB基础】HTML & CSS 基础入门(3)段落及文本
  4. 视差滚动与图像仅通过徽标透明度
  5. 动态更改angularjs中静态段落的颜色
  6. Python Module之textwrap - 文本段落格式编排

随机推荐

  1. Python之父重回决策层,未来如何发展?
  2. 聊聊技术写作的个人体会
  3. Python进阶:迭代器与迭代器切片
  4. 华熙LIVE以创新模式 打造城市活力聚集地
  5. [译]PEP 380--子生成器的语法
  6. Python骚操作:动态定义函数
  7. 没有食材,数据分析师如何做饭?
  8. 深度辨析 Python 的 eval() 与 exec()
  9. 条码读取控件Dynamsoft Barcode Reader v
  10. Python与家国天下