0

アニメーションが表示されたら、要素にアニメーションを設定するにはどうすればよいですか?(同じプロパティを持つ他の人が落ち着くように。)私はこのようにしようとしています:

        $.each(data, function(i, obj) {
            if(obj['Ping'] == "FALSE"){
                out = "<li class='red'>"+obj.Vardas+" is down..."+obj.Data+"</li>";
                /////animation, once the element gets generated
                $(out).prependTo('#database').animate({fontColor:"red", 1000});
                out ="";
            }else{
                out = "<li>"+obj.Vardas+" is up......."+obj.Data+"</li>";
                $(out).prependTo('#database');
                out ="";    
            }
        });

    });
});
</script>
</head>

<body>
    <div style="float:right; overflow-y:scroll; height: 400px; width: 50%">
        <ul id ='database'></ul>
    </div>
4

1 に答える 1

0

jQuery はアニメーションに色を使用できません。ただし、そのような場合は、jQuery Color プラグイン ( https://github.com/jquery/jquery-color ) を使用できます。

不透明度の点滅を使用した小さな作業例を次に示します。

<head>
  <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
  <script>

    var t = function(){
        for(var i = 0; i < 5; i++){
            $("<li>ata" + i + "tata</li>").prependTo($("ul")).animate({opacity: 0.10}, 200).animate({opacity: 1}, 200);
        }
    }

    $(function(){
        setInterval(t, 1000);
    });

  </script>
</head>

<body>
    <ul> </ul>
</body>
</html>
于 2012-11-27T20:10:43.480 に答える