처음 그래서 난이
HTML
<form method="post" action="" onsubmit="return false;">
<div id="vsetko">
<textarea id="scontent"></textarea>
<div id="sbutton_block" style="display:none;">
<input type="submit" id="sbutton" value=" Share " />
</div>
</div>
</form>
CSS
#scontent {
overflow: auto;
width:722px;
height:30px;
border:solid 2px #006699;
font-size:14px;
}
#sbutton{
background-color:#006699;
color:#ffffff;
font-size:13px;
font-weight:bold;
padding:4px;
margin-bottom: 5px;
}
로 변경
내가 HTML을 클릭 기능을 수정했다 : 포커스 이벤트를 대체 할 JQUERY
$(document).ready(function(){
$("#scontent").focus(function(){
$(this).animate({"height": "85px",}, "fast");
$("#sbutton_block").slideDown("fast");
return false;
});
$("html").click(function(event){
if ($(event.target).attr("id") != "scontent") {
$("#scontent").animate({"height": "30px",}, "fast");
$("#sbutton_block").slideUp("fast");
return false;
}
});
$("#scontent").keypress(function(){
var MaxLen = 250;
return ($(this).val().length <= MaxLen);
});
$("#sbutton").click(function(){
// do your stuff
return false;
});
});
때문에 전체 HTML 클릭 이벤트는, 당신은 데이터
내가 잘
편집 작업의 내 노트북에 테스트를했습니다을 절약 할 수 건너 뛸 요소를 확인하는 방법
답변 해 주셔서 감사합니다. 어떤 이유로 텍스트 상자는 텍스트 영역 안쪽이 아니라 사이트의 아무 곳이나 클릭하면 크기가 변경됩니다. 마우스 버튼을 놓은 후 제출 버튼이 사라집니다. – Mark
답변이 업데이트되었습니다. http://jsfiddle.net/MgLa6/1/ 여기에서 온라인 확인하십시오 – Kotzilla
안녕하세요! 이 코드는 페이지의 모든 링크를 비활성화했습니다. $ ("html"). { if ($ event.target) .attr ("id")! = "scontent") { $ $ ("# sbutton_block") slideUp ("빠름") false를 반환합니다. } }}) 애니메이션 ({ "높이": "30px", " ; 어떻게 해결할 수 있습니까? – Mark