편집 요약 없음 태그: 되돌려진 기여 |
편집 요약 없음 태그: 되돌려진 기여 |
||
| 1번째 줄: | 1번째 줄: | ||
$(document).ready(function () { | $(document).ready(function () { | ||
// .custom-toggle 클릭 이벤트 핸들러 | // 기존의 .custom-toggle 클릭 이벤트 핸들러 | ||
$('.custom-toggle').click(function () { | $('.custom-toggle').click(function () { | ||
$(this).next('.custom-content').stop().slideToggle(300); | $(this).next('.custom-content').stop().slideToggle(300); | ||
}); | }); | ||
| 8번째 줄: | 8번째 줄: | ||
$('.toggle-collapse').click(function () { | $('.toggle-collapse').click(function () { | ||
var $this = $(this); | var $this = $(this); | ||
var | var $rowContent = $this.closest('tr').next().find('.table-row-content'); | ||
var isCollapsed = $this.data('collapsed') === true; | var isCollapsed = $this.data('collapsed') === true; | ||
// | // 애니메이션으로 열고 닫기 | ||
if (isCollapsed) { | |||
$rowContent.removeClass('open').css('height', '0'); | |||
} else { | |||
$rowContent.addClass('open').css('height', $rowContent.prop('scrollHeight') + 'px'); | |||
$ | |||
} | } | ||
// 상태 변경 및 텍스트 업데이트 | // 상태 변경 및 텍스트 업데이트 | ||
$this.data('collapsed', !isCollapsed); | $this.data('collapsed', !isCollapsed); | ||
$this.text(isCollapsed ? | $this.text(isCollapsed ? '펼치기' : '접기'); | ||
}); | }); | ||
| 32번째 줄: | 26번째 줄: | ||
$('.toggle-collapse').each(function () { | $('.toggle-collapse').each(function () { | ||
var $this = $(this); | var $this = $(this); | ||
var | var $rowContent = $this.closest('tr').next().find('.table-row-content'); | ||
var isCollapsed = $this.data('collapsed') === true; | var isCollapsed = $this.data('collapsed') === true; | ||
if (isCollapsed) { | if (isCollapsed) { | ||
$rowContent.removeClass('open').css('height', '0'); | |||
$this.text('펼치기'); | |||
$this.text( | |||
} else { | } else { | ||
$this.text( | $rowContent.addClass('open').css('height', $rowContent.prop('scrollHeight') + 'px'); | ||
$this.text('접기'); | |||
} | } | ||
}); | }); | ||
}); | |||
// <nolinkstyle> 태그를 .nolinkstyle 클래스로 변환 | // <nolinkstyle> 태그를 .nolinkstyle 클래스로 변환 | ||
| 58번째 줄: | 45번째 줄: | ||
$this.replaceWith('<span class="nolinkstyle">' + content + '</span>'); | $this.replaceWith('<span class="nolinkstyle">' + content + '</span>'); | ||
}); | }); | ||
2024년 11월 28일 (목) 20:40 판
$(document).ready(function () {
// 기존의 .custom-toggle 클릭 이벤트 핸들러
$('.custom-toggle').click(function () {
$(this).next('.custom-content').stop().slideToggle(300);
});
// .toggle-collapse 클릭 이벤트 핸들러 (표 행 전환)
$('.toggle-collapse').click(function () {
var $this = $(this);
var $rowContent = $this.closest('tr').next().find('.table-row-content');
var isCollapsed = $this.data('collapsed') === true;
// 애니메이션으로 열고 닫기
if (isCollapsed) {
$rowContent.removeClass('open').css('height', '0');
} else {
$rowContent.addClass('open').css('height', $rowContent.prop('scrollHeight') + 'px');
}
// 상태 변경 및 텍스트 업데이트
$this.data('collapsed', !isCollapsed);
$this.text(isCollapsed ? '펼치기' : '접기');
});
// 페이지 로드 시 초기 상태 설정
$('.toggle-collapse').each(function () {
var $this = $(this);
var $rowContent = $this.closest('tr').next().find('.table-row-content');
var isCollapsed = $this.data('collapsed') === true;
if (isCollapsed) {
$rowContent.removeClass('open').css('height', '0');
$this.text('펼치기');
} else {
$rowContent.addClass('open').css('height', $rowContent.prop('scrollHeight') + 'px');
$this.text('접기');
}
});
});
// <nolinkstyle> 태그를 .nolinkstyle 클래스로 변환
$('nolinkstyle').each(function() {
var $this = $(this);
var content = $this.html();
$this.replaceWith('<span class="nolinkstyle">' + content + '</span>');
});