편집 요약 없음 태그: 수동 되돌리기 |
편집 요약 없음 |
||
| (같은 사용자의 중간 판 54개는 보이지 않습니다) | |||
| 1번째 줄: | 1번째 줄: | ||
$(document).ready(function() { | $(document).ready(function() { | ||
// | // .custom-toggle 클릭 이벤트 핸들러 | ||
$('.custom-toggle').click(function() { | $('.custom-toggle').click(function() { | ||
$(this).next('.custom-content').slideToggle(); | $(this).next('.custom-content').slideToggle(); | ||
}); | |||
// 페이지 로드 시 기본 상태 설정 | |||
$('.custom-toggle').each(function() { | |||
var $this = $(this); | |||
var isCollapsed = $this.data('collapsed') === true; | |||
if (isCollapsed) { | |||
$this.next('.custom-content').hide(); | |||
} else { | |||
$this.next('.custom-content').show(); | |||
} | |||
}); | |||
// 접기 상태를 확인하고 초기화하는 코드 | |||
$('.custom-toggle').each(function() { | |||
var $this = $(this); | |||
var collapsedState = $this.data('collapsed'); | |||
// '유형'에 맞는 접기 상태 설정 | |||
if (collapsedState !== undefined) { | |||
if (collapsedState === true) { | |||
$this.next('.custom-content').hide(); | |||
} else { | |||
$this.next('.custom-content').show(); | |||
} | |||
} | |||
}); | }); | ||
| 10번째 줄: | 37번째 줄: | ||
var rowsToToggle = parseInt($this.data('rows')) || 1; | var rowsToToggle = parseInt($this.data('rows')) || 1; | ||
var isCollapsed = $this.data('collapsed') === true; | var isCollapsed = $this.data('collapsed') === true; | ||
// 사용자 정의 텍스트 | // 사용자 정의 텍스트 설정 | ||
var expandText = $this.data('expand-text') || '펼치기'; | var expandText = $this.data('expand-text') || '펼치기'; | ||
var collapseText = $this.data('collapse-text') || expandText; | var collapseText = $this.data('collapse-text') || expandText; | ||
// 지정된 행 수만큼 다음 행을 즉시 표시/숨김 | // 지정된 행 수만큼 다음 행을 즉시 표시/숨김 | ||
var $row = $this.closest('tr'); | |||
for (var i = 0; i < rowsToToggle; i++) { | for (var i = 0; i < rowsToToggle; i++) { | ||
$row = $row.next(); | $row = $row.next(); | ||
if ($row.length) { | if ($row.length) { | ||
$row.toggle(); // 슬라이드 | $row.toggle(); // 슬라이드 없이 즉시 토글 | ||
} | } | ||
} | } | ||
| 29번째 줄: | 56번째 줄: | ||
}); | }); | ||
// | // .toggle-collapse 클릭 이벤트 핸들러 | ||
$('.toggle-collapse'). | $('.toggle-collapse').click(function() { | ||
var $this = $(this); | var $this = $(this); | ||
var rowsToToggle = parseInt($this.data('rows')) || 1; | var rowsToToggle = parseInt($this.data('rows')) || 1; | ||
var isCollapsed = $this.data('collapsed') === true; | var isCollapsed = $this.data('collapsed') === true; | ||
// 사용자 정의 텍스트 | // 사용자 정의 텍스트 설정 | ||
var expandText = $this.data('expand-text') || '펼치기'; | var expandText = $this.data('expand-text') || '펼치기'; | ||
var collapseText = $this.data('collapse-text') || expandText; | var collapseText = $this.data('collapse-text') || expandText; | ||
// 지정된 행 수만큼 다음 행을 즉시 표시/숨김 | |||
var $row = $this.closest('tr'); | |||
for (var i = 0; i < rowsToToggle; i++) { | |||
$row = $row.next(); | |||
if ($row.length) { | |||
$row.toggle(); // 슬라이드 없이 즉시 토글 | |||
} | } | ||
} | } | ||
// 상태 토글 | |||
$this.data('collapsed', !isCollapsed); | |||
$this.text($this.data('collapsed') ? expandText : collapseText); | |||
}); | }); | ||
2024년 11월 29일 (금) 23:47 기준 최신판
$(document).ready(function() {
// .custom-toggle 클릭 이벤트 핸들러
$('.custom-toggle').click(function() {
$(this).next('.custom-content').slideToggle();
});
// 페이지 로드 시 기본 상태 설정
$('.custom-toggle').each(function() {
var $this = $(this);
var isCollapsed = $this.data('collapsed') === true;
if (isCollapsed) {
$this.next('.custom-content').hide();
} else {
$this.next('.custom-content').show();
}
});
// 접기 상태를 확인하고 초기화하는 코드
$('.custom-toggle').each(function() {
var $this = $(this);
var collapsedState = $this.data('collapsed');
// '유형'에 맞는 접기 상태 설정
if (collapsedState !== undefined) {
if (collapsedState === true) {
$this.next('.custom-content').hide();
} else {
$this.next('.custom-content').show();
}
}
});
// .toggle-collapse 클릭 이벤트 핸들러
$('.toggle-collapse').click(function() {
var $this = $(this);
var rowsToToggle = parseInt($this.data('rows')) || 1;
var isCollapsed = $this.data('collapsed') === true;
// 사용자 정의 텍스트 설정
var expandText = $this.data('expand-text') || '펼치기';
var collapseText = $this.data('collapse-text') || expandText;
// 지정된 행 수만큼 다음 행을 즉시 표시/숨김
var $row = $this.closest('tr');
for (var i = 0; i < rowsToToggle; i++) {
$row = $row.next();
if ($row.length) {
$row.toggle(); // 슬라이드 없이 즉시 토글
}
}
// 상태 토글
$this.data('collapsed', !isCollapsed);
$this.text($this.data('collapsed') ? expandText : collapseText);
});
// .toggle-collapse 클릭 이벤트 핸들러
$('.toggle-collapse').click(function() {
var $this = $(this);
var rowsToToggle = parseInt($this.data('rows')) || 1;
var isCollapsed = $this.data('collapsed') === true;
// 사용자 정의 텍스트 설정
var expandText = $this.data('expand-text') || '펼치기';
var collapseText = $this.data('collapse-text') || expandText;
// 지정된 행 수만큼 다음 행을 즉시 표시/숨김
var $row = $this.closest('tr');
for (var i = 0; i < rowsToToggle; i++) {
$row = $row.next();
if ($row.length) {
$row.toggle(); // 슬라이드 없이 즉시 토글
}
}
// 상태 토글
$this.data('collapsed', !isCollapsed);
$this.text($this.data('collapsed') ? expandText : collapseText);
});
// <nolinkstyle> 태그를 .nolinkstyle 클래스로 변환
$('nolinkstyle').each(function() {
var $this = $(this);
var content = $this.html();
$this.replaceWith('<span class="nolinkstyle">' + content + '</span>');
});
});