2016-08-03 4 views
0

ここは私のフィドルlinkです。入力用ライン構築アニメーション

jQuery('input').focusin(function(){ 
    window.setTimeout(function() { 
    jQuery('input').addClass('animatedBottomBorder'); 
    }, 150); 
    window.setTimeout(function() { 
    jQuery('input').addClass('animatedLeftBorder'); 
    }, 300); 
    window.setTimeout(function() { 
    jQuery('input').addClass('animatedTopBorder'); 
    }, 450); 
    window.setTimeout(function() { 
    jQuery('input').addClass('animatedRightBorder'); 
    }, 600); 
}); 
jQuery('input').focusout(function(){ 
    jQuery('.searchTextField').removeClass('animatedBottomBorder'); 
    jQuery('.searchTextField').removeClass('animatedLeftBorder'); 
    jQuery('.searchTextField').removeClass('animatedTopBorder'); 
    jQuery('.searchTextField').removeClass('animatedRightBorder'); 
}); 

focusinイベントでは、境界がフェードインして、フォーカスアウトイベント境界が消えます。

しかし、移動中の線は非常に速くなります。今は動いているフェードでロードしますが、私は動いて動くようにします。

+0

クリックするとアニメーションが速くなりますか? –

+0

はい、私は速くしたいですが、主な問題は、ラインのように、ムービングアニメーションにフェードアニメーションを変更したいですか? @DebakantMohanty – aidadev

+0

代わりにcss3アニメーションを使用する方が簡単でしょうか? Le:キーフレームアニメーション –

答えて

0

は、以下のコードを試してください:これは役立つ

jQuery('input').focusin(function(){ 
    window.setTimeout(function() { 
    jQuery('input').css({"border-right-color": 'blue'}).animate({ 
     borderWidth: 4 
    }, 500, 'swing'); 
    }, 150); 
    window.setTimeout(function() { 
    jQuery('input').css({"border-bottom-color": 'green'}).animate({ 
     borderWidth: 4 
    }, 500, 'swing'); 
    }, 300); 
    window.setTimeout(function() { 
    jQuery('input').css({"border-left-color": 'black'}).animate({ 
     borderWidth: 4 
    }, 500, 'swing'); 
    }, 450); 
    window.setTimeout(function() { 
    jQuery('input').css({"border-top-color": 'red'}).animate({ 
     borderWidth: 4 
    }, 500, 'swing'); 
    }, 600); 
}); 

希望!!

+0

ありがとうございます。しかし、やはりフェードモードでは、境界線が白い色で塗りつぶされ、建物の線の効果を作り出すようにしたいと思います。何か案は? @Debakant Mohanty – aidadev

関連する問題