3

いくつかの機能を追加setTimeoutしました.1つは正常に実行されていますが、別の機能はまったく実行されていないようです. 全く同じなのでなんとも言えません。私のコードの下に見つけてください。

これは、私が見ている setTimeout 行です。これは正常に動作します。

var fctyhov = function (z) {
    $(deptmts[i]).hover(
        function(){
            $(fcultys[z]).stop(true).animate({color: col1});
            setTimeout(function(){$(z).css("text-shadow", tsh1);},100);},
        function(){
            $(fcultys[z]).stop(true).animate({color: col3});
            setTimeout(function(){$(z).css("text-shadow", tsh2);},100);}
    );
};

しかし、これはそうではありません

var facdth = function (y,x,w) {
    $(y).hover(
        function(){
            $(x).stop(true).fadeTo("fast", 1);
            $(w).stop(true).delay().animate({color:col1});
            $(y).stop(true).animate({color: col1});
            setTimeout(function(){$(y).css("text-shadow", tsh1);},100);},
        function(){
            $(x).stop(true).fadeTo("slow", 0);
            $(w).stop(true).delay().animate({color:col2});
            $(y).stop(true).animate({color: col3});
            setTimeout(function(){$(y).css("text-shadow", tsh2);},100);}
    );
};

編集 .animate({color}) を機能させるプラグインを追加しました。これらの行は正常に機能しています。

4

1 に答える 1

2

上記のコメントとヘルプをありがとう。疲れていない朝にこれをもう一度見ると、より鮮明になりました。私が抱えていた問題は、最初のステートメントにあり、機能していると思いました。

関数で呼び出していた場所は$(z).css、. これはばかげた間違いでした。私の作業コードについては以下を参照してください。 setTimout$(fcultys[z]).css

var fctyhov = function (z) {
    $(deptmts[i]).hover(
        function(){
            $(fcultys[z]).stop(true).animate({color: col1});
            setTimeout(function(){$(fcultys[z]).css("text-shadow", tsh1);},100);},
        function(){
            $(fcultys[z]).stop(true).animate({color: col3});
            setTimeout(function(){$(fcultys[z]).css("text-shadow", tsh2);},100);}
    );
};
于 2012-11-23T08:23:27.997 に答える