2012-02-08 82 views
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'); 
}); 
}; 

回答

0

代替.focus和.blur嘗試:

.live( '鼠標懸停',()的函數)和.live( '鼠標移開',()的函數) ...右側選擇器上的.stop()應該做你想做的事情。在代碼中搜索另一個原因,爲什麼這不起作用。不能看到任何問題,爲什麼它不應該工作。

文章編輯!

+0

nope,它不工作.... – BurebistaRuler 2012-02-08 13:49:48