0

I have a span element:

<span id="signInResult" style="border: 1px solid white;">html in here</span>

when the jquery ajax success fires I would like the span to immediately turn green and then fade back to the default white color:

success: function(msg){
  $("#signInResult").css('border-style', 'solid');
  $("#signInResult").css('border-color', 'green');
  $("#signInResult").fadeIn(300).css('border-color', 'white').fadeIn(300);
}

I have tried a number of variations of the fadeIn and fadeOut.. the current version above doesn't seem to do anything.... best way to do this to get desire result? thanks

4

2 に答える 2

1

を使用することもできますanimate。指定された時間枠で、指定された css プロパティを指定された値にゆっくりと変更します。FadeIn/FadeOut はopacityとのみを扱いdisplayます。

試す:

success:function(msg) {
    $("#signInResult").css('border-color', '#0f0').animate({'border-color': '#fff'}, 300);
}

ドキュメント: http://api.jquery.com/animate/

于 2013-02-03T05:02:53.523 に答える
1

あなたの質問は、境界線の色を変更したいと述べているので、色をアニメーション化するには、これを試してください:

http://jsbin.com/anubin/1/edit

 $(function() {
    $("#signInResult").css('border-style', 'solid');
    $("#signInResult").css('border-color', 'green');
    $("#signInResult").hide().fadeIn(300);

    $("#signInResult").animate({
        borderColor: "white",
        width: 500
      }, 1000 );
 });

jquery uiプラグインが必要です。

于 2013-02-03T05:14:28.887 に答える