게시판 진입시 게시판 메뉴 오픈
parent
50bb514733
commit
dd36eda244
|
|
@ -3,6 +3,8 @@ $(function (){
|
|||
format: "yyyy-mm-dd",
|
||||
language: "ko"
|
||||
});
|
||||
|
||||
setMenu();
|
||||
})
|
||||
$(document).on('click', '.categoryTr', function (){
|
||||
if(location.pathname.indexOf("contentSearch")<0){
|
||||
|
|
@ -127,4 +129,25 @@ function getBoardLog(contentSeq){
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setMenu(){
|
||||
const categorySeq = getParam("categorySeq");
|
||||
openMenu($("[data-categoryseq='"+categorySeq+"']").attr("data-parentseq"));
|
||||
}
|
||||
|
||||
function getParam(sname) {
|
||||
const paramAry = location.search.substr(1).split("&");
|
||||
for (let i = 0; i < paramAry.length; i++) {
|
||||
const param = paramAry[i].split("=");
|
||||
if (param[0] === sname) { return param[1]; }
|
||||
}
|
||||
}
|
||||
|
||||
function openMenu(parentSeq){
|
||||
if(parentSeq){
|
||||
const target = $("[data-categoryseq='"+parentSeq+"']")
|
||||
target.click();
|
||||
openMenu(target.attr("data-parentseq"));
|
||||
}
|
||||
}
|
||||
|
|
@ -24,8 +24,9 @@
|
|||
<th:block th:each="depth1:${session.categoryList}">
|
||||
<li class="mb-1">
|
||||
<button class="btn btn-toggle align-items-center rounded collapsed"
|
||||
data-bs-toggle="collapse" aria-expanded="false" th:data-bs-target="'#collapse'+${depth1.categorySeq}"
|
||||
th:text="${depth1.categoryName}">
|
||||
data-bs-toggle="collapse" aria-expanded="false"
|
||||
th:data-categoryseq="${depth1.categorySeq}"
|
||||
th:data-bs-target="'#collapse'+${depth1.categorySeq}" th:text="${depth1.categoryName}">
|
||||
</button>
|
||||
<div class="collapse ps-3" th:id="|collapse${depth1.categorySeq}|">
|
||||
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1">
|
||||
|
|
@ -34,8 +35,9 @@
|
|||
<ul class="list-unstyled ps-0">
|
||||
<li class="mb-1">
|
||||
<button class="btn btn-toggle align-items-center rounded collapsed"
|
||||
data-bs-toggle="collapse" aria-expanded="false"
|
||||
th:data-bs-target="'#collapse'+${depth2.categorySeq}" th:text="${depth2.categoryName}">
|
||||
data-bs-toggle="collapse" aria-expanded="false"
|
||||
th:data-categoryseq="${depth2.categorySeq}" th:data-parentseq="${depth2.parentSeq}"
|
||||
th:data-bs-target="'#collapse'+${depth2.categorySeq}" th:text="${depth2.categoryName}">
|
||||
</button>
|
||||
<div class="collapse ps-3" th:id="|collapse${depth2.categorySeq}|">
|
||||
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1">
|
||||
|
|
@ -44,13 +46,17 @@
|
|||
<ul class="list-unstyled ps-0">
|
||||
<li class="mb-1">
|
||||
<button class="btn btn-toggle align-items-center rounded collapsed"
|
||||
data-bs-toggle="collapse" aria-expanded="false"
|
||||
th:data-bs-target="'#collapse'+${depth3.categorySeq}" th:text="${depth3.categoryName}">
|
||||
data-bs-toggle="collapse" aria-expanded="false"
|
||||
th:data-categoryseq="${depth3.categorySeq}" th:data-parentseq="${depth3.parentSeq}"
|
||||
th:data-bs-target="'#collapse'+${depth3.categorySeq}" th:text="${depth3.categoryName}">
|
||||
</button>
|
||||
<div class="collapse ps-3" th:id="|collapse${depth3.categorySeq}|">
|
||||
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1">
|
||||
<th:block th:each="depth4:${depth3.childCategoryList}">
|
||||
<li><a th:href="|@{/board/contentList}?categorySeq=${depth4.categorySeq}|" class="bi bi-dash link-dark rounded ps-3 text-decoration-none" th:text="${depth4.categoryName}"></a></li>
|
||||
<li><a th:href="|@{/board/contentList}?categorySeq=${depth4.categorySeq}|"
|
||||
th:data-categoryseq="${depth4.categorySeq}" th:data-parentseq="${depth4.parentSeq}"
|
||||
class="bi bi-dash link-dark rounded ps-3 text-decoration-none"
|
||||
th:text="${depth4.categoryName}"></a></li>
|
||||
</th:block>
|
||||
<th:block th:if="${depth3.childCategoryList.size==0}">
|
||||
<li>등록된 소분류가 없습니다.</li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue