嗨,朋友,我有一個textarea,我想使用此元素的animate()
和css()
函數。只關注一次 - jquery
css()
功能正常,但問題是focus()
func。頁面加載後一切都很好,
當我集中到textarea它的高度增加了50px,但是當我模糊,然後再次聚焦到textarea然後高度再次增加50px。我不想使用blur()
函數。
我的問題是關於使用focus()
函數。我想每頁加載一次使用focus()
。
<script>
$(document).ready(function(){
$("#sharePost").focus(function(){
$(this).animate({height:"+=50px"});
$(this).css("background-color","#ffccdd");
});
$("#sharePost").blur(function(){
//$(this).animate({height:"-=50px"});
});
});
</script>