1

入力親のマージン権を取得するために親クラスを配置するこの関数があります。親の動作を少し変更して、この「$(this).parent().addClass('cooling');」を「」 に置き換えたいのですが$(this).parent().animate({ marginRight: "200px" }, slow );、ぼかしの際にそのアニメーションマージンを削除する方法がわかりません。誰かが私を助けることができれば...

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');
});
};
4

1 に答える 1

0

代わりに.focusと.blurを試してください:

右側のセレクターの.live('mouseover'、function())および.live('mouseout'、function())... .stop()は、必要な処理を実行する必要があります。これが機能しない理由をコードで検索します。なぜそれが機能しないのか、問題はわかりません。

投稿編集!

于 2012-02-08T13:16:11.193 に答える