버튼을 클릭하면 일부 상자를 표시하거나 숨길 수 있습니다. 잘 작동하지만 처음 상자를 숨기려면 2 번 클릭해야합니다.Jquery UI slideUp 및 slideDown
이 내 JS 코드 :
$(function() {
$('.title .hide').showContent();
});
$.fn.showContent = function() {
return this.each(function() {
var box = $(this);
var content = $(this).parent().next('.content');
box.toggle(function() {
content.slideDown(400);
}, function() {
content.slideUp(400);
});
});
};
그리고 드 HTML
<div class="box">
<div class="title">
Title
<span class="hide"></span>
</div>
<div class="content">Content</div>
</div>
이 왜? 누군가 나를 도울 수 있습니까? 여기
그리고
는 데모입니다 : (.. 당신이 아무것도하지를 처음 클릭하면 검은 색 버튼을 클릭,하지만 두 번째 시간은 다음 내용이 붕괴됩니다) http://jsfiddle.net/wq7PF/이
HTML을 게시하십시오. – j08691
@ j08691 완료. :) – Maanstraat
@Maanstraat HTML에서 말하는 버튼은 어디에 있습니까? – esqew