2012-02-08 6 views
1

私は入力親に対して余白を持つために親クラスを置くこの関数を持っています。私は少し親のbehaiviorを変更し、この "$(this).parent().addClass('cooling');"を " $(this).parent().animate({ marginRight: "200px" }, slow);"と置き換えたいと思いますが、そのアニメーションの余白をぼかす方法を知りません。誰も私を助けることができるなら...私の関数のぼかしに関する.animationを削除する

function inputWidth(){ 
    $('input[type=text]') 
.focus(function() { 
    if ($(this).val().length > 21) { 
     $(this).data('default', $(this).data('default') || $(this).width()); 
     $(this).stop().animate({width: 300}, 'slow'); 
     $(this).parent().addClass('cooling'); 
     //$(this).parent().animate({ marginRight: "200px" }, slow); 
    } 
}) 
.blur(function() { /* lookup the original width */ 
    $(this).stop().animate({width: 
    $(this).data('default')},'fast'); 
    $(this).parent().removeClass('cooling'); 
}); 
}; 

答えて

0

代わり.focusと.blur試してみてください。

.live( 'マウスオーバー'、機能())と.live( 'マウスアウト'、()関数) ...右のセレクタの.stop()は、あなたが望むことをするはずです。なぜあなたのコード内の別の理由を検索して、これが動作していないのですか?なぜそれがうまくいかないかという問題を見ることができません。

ポスト編集済み!

+0

いいえ、動作していません.... – BurebistaRuler

関連する問題