본문 바로가기
조회 수 70 추천 수 0 댓글 8
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form

대략 어떤걸 숨겨야 할지는 알겠는데 문제는 공지 접기 버튼을 누르면 공지 펼치기로 바뀌는 부분과 새로고침을 해도 공지 접기나 펼치기 상태가 게시판 한정으로 반영이 되어야함. 이걸 보르겠음.

Who's 뉴리대장

profile

아이마스 좋아하는 코더.

목록
  • profile
    작성자 뉴리대장Best 2022.07.13 15:40

    감사합니다. 제이쿼리 없는 바닐라 js네요. 해당 코드 참조해서 구현해 보도록 하겠습니다.

  • ?
    갓수가되고싶따Best 2022.07.13 15:24
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8"/>
    <title>제목</title>
    </head>
    </body>
    <style>
    #toc-content {
    display: none;
    }
    #toc-toggle {
    cursor: pointer;
    color: #2962ff;
    }
    #toc-toggle:hover {
    text-decoration: underline;
    }
    </style>

    목차 [<span id="toc-toggle" onclick="openCloseToc()">보이기</span>]
    <ol id="toc-content">
    <li>HTML</li>
    <li>CSS</li>
    <li>JavaScript</li>
    </ol>

    <script>
    var view_key=localStorage.getItem('view_key');
    console.log(view_key);
    if(view_key=="true"){
    document.getElementById('toc-content').style.display = 'none';
    document.getElementById('toc-toggle').textContent = '보이기';
    }else if(view_key=="false"){
    document.getElementById('toc-content').style.display = 'block';
    document.getElementById('toc-toggle').textContent = '숨기기';
    }
    function openCloseToc() {
    if(document.getElementById('toc-content').style.display === 'block') {
    document.getElementById('toc-content').style.display = 'none';
    document.getElementById('toc-toggle').textContent = '보이기';
    localStorage.setItem('view_key',true);
    } else {
    document.getElementById('toc-content').style.display = 'block';
    document.getElementById('toc-toggle').textContent = '숨기기';
    localStorage.setItem('view_key',false);
    }
    }
    </script>
    </body>
    </html>

    일단 만들어봣는데 위 소스 그대로 html 파일로 만들어서 테스트 해보시면 될듯
    생각하시는게 다를거 같아서 틀릴수도있을거같은데 개인적으로는 공부가 되서 잘 써먹을듯요
  • ?
    갓수가되고싶따 2022.07.13 14:50

    https://joshua-dev-story.blogspot.com/2020/09/javascript-collapse.html

    이 블로그 참고해보시는건 어떨지?

    고정은 css style 쪽에서 고정시키거나 따로 값을 가지고 있게해서 적용해야할거같은데 그건 좀더 찾아봐야할듯요

  • ?
    갓수가되고싶따 2022.07.13 15:10
    css 고정은 localstorage 라는게 잇어서 찾아보고있는데 얼추 정리되면 예시코드 한번 드릴수있을듯요
  • profile
    작성자 뉴리대장 2022.07.13 15:14
    일단 공지글 자체는 tr.notice만 날리면 됨. 그 날리는 버튼을 어떻게 만드는지가 문제임.
  • ?
    갓수가되고싶따 2022.07.13 15:24
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8"/>
    <title>제목</title>
    </head>
    </body>
    <style>
    #toc-content {
    display: none;
    }
    #toc-toggle {
    cursor: pointer;
    color: #2962ff;
    }
    #toc-toggle:hover {
    text-decoration: underline;
    }
    </style>

    목차 [<span id="toc-toggle" onclick="openCloseToc()">보이기</span>]
    <ol id="toc-content">
    <li>HTML</li>
    <li>CSS</li>
    <li>JavaScript</li>
    </ol>

    <script>
    var view_key=localStorage.getItem('view_key');
    console.log(view_key);
    if(view_key=="true"){
    document.getElementById('toc-content').style.display = 'none';
    document.getElementById('toc-toggle').textContent = '보이기';
    }else if(view_key=="false"){
    document.getElementById('toc-content').style.display = 'block';
    document.getElementById('toc-toggle').textContent = '숨기기';
    }
    function openCloseToc() {
    if(document.getElementById('toc-content').style.display === 'block') {
    document.getElementById('toc-content').style.display = 'none';
    document.getElementById('toc-toggle').textContent = '보이기';
    localStorage.setItem('view_key',true);
    } else {
    document.getElementById('toc-content').style.display = 'block';
    document.getElementById('toc-toggle').textContent = '숨기기';
    localStorage.setItem('view_key',false);
    }
    }
    </script>
    </body>
    </html>

    일단 만들어봣는데 위 소스 그대로 html 파일로 만들어서 테스트 해보시면 될듯
    생각하시는게 다를거 같아서 틀릴수도있을거같은데 개인적으로는 공부가 되서 잘 써먹을듯요
  • ?
    갓수가되고싶따 2022.07.13 15:29
    html 코드 이대로 올려도 괜찮은지는 모르겟는데 문제가 된다면 얘기해주시면 바로 삭제하겟습니다~
  • profile
    작성자 뉴리대장 2022.07.13 15:40

    감사합니다. 제이쿼리 없는 바닐라 js네요. 해당 코드 참조해서 구현해 보도록 하겠습니다.

  • ?
    갓수가되고싶따 2022.07.13 15:42
    화이팅입니다 ^^
  • profile
    일립시S 2022.07.13 18:21

    이거 내가 파일 목록 접기 스크립트 만들어놓은 거 쿠키랑 섞어 쓰면 될 텐데


유머/자유 게시판

유머를 포함하여 국내 정치 이외의 이야기를 자유롭게 할 수 있는 게시판 입니다

  1. No Image notice

    최근 발생한 사이트 내 문제의 원인에 대하여 (2)

    Date2024.07.11 By뉴리대장 Views130 Votes3
    read more
  2. No Image notice

    사이트 이용 규칙(2024.02.23. 수정) (17)

    Date2022.06.29 By뉴리대장 Views3784 Votes34
    read more
  3. No Image notice

    수위가 있는 게시물에 대해 (3)

    Date2022.07.04 Category공지 By뉴리대장 Views1985 Votes12
    read more
  4. No Image notice

    유머/자유 게시판 이용 안내 및 규칙 (7)

    Date2022.06.29 Category공지 By뉴리대장 Views2108 Votes19
    read more
  5. No Image

    홍콩반점왔서요 (4)

    Date2024.06.24 Category잡담 By오버도즈 Views36 Votes1
    Read More
  6. 홀로큐어란 이런게임 (2)

    Date2022.07.02 Category애니/서브컬쳐 By마음의거울 Views117 Votes2
    Read More
  7. 홀로큐어)첫 클리어! (1)

    Date2022.06.30 Category애니/서브컬쳐 By강대수 Views95 Votes0
    Read More
  8. 홀로큐어) 아이러니의 극치

    Date2022.07.03 Category애니/서브컬쳐 ByI.C.Q Views64 Votes0
    Read More
  9. 홀로러스트 멤버들과 이 사진을 합친 그림을 보고싶다. (1)

    Date2022.07.30 Category버튜버 By뉴리넷-4305747125 Views76 Votes1
    Read More
  10. 홀로라이브) 카나데 원한다 to 산다 함께 고양이 (1)

    Date2024.07.17 Category버튜버 By고래껄룩이 Views19 Votes2
    Read More
  11. 홀로라이브) 소라쨩 몰래 엣찌한 거 보는 소라토모 (1)

    Date2024.07.18 Category버튜버 By고래껄룩이 Views21 Votes2
    Read More
  12. No Image

    홀로라이브) 사람은... 사랑하는 사람을 닮는대(?) (1)

    Date2024.07.01 Category버튜버 By고래껄룩이 Views13 Votes0
    Read More
  13. No Image

    홀로라이브 공홈 복사 방지가 신박하네 (3)

    Date2022.07.12 Category잡담 By뉴리대장 Views77 Votes0
    Read More
  14. No Image

    홀로그라) 폴카가 범고래 군단을 이끌고 습격하는.mp4 (1)

    Date2024.06.23 Category버튜버 By고래껄룩이 Views28 Votes2
    Read More
  15. 홀로)젖소키니 (4)

    Date2024.07.26 Category버튜버 By정달호 Views25 Votes5
    Read More
  16. Update

    홀로) 하이레그 검스 키아라 (4)

    Date2024.07.26 Category버튜버 By정달호 Views11 Votes2
    Read More
  17. 홀로 큐어 하던 유게이들아 (9)

    Date2022.06.29 Category유머 Byhakane Views228 Votes12
    Read More
  18. 홀로 비키니 Holo Bikinis 👙 (7)

    Date2024.06.26 Category버튜버 By정달호 Views48 Votes4
    Read More
  19. 혼란스러운 짤.png (4)

    Date2022.07.05 Category유머 By김가우르 Views141 Votes3
    Read More
  20. No Image

    혹시라도 저렴하게 사이트를 만들고 싶으면 오라클 클라우드 프리티어도 좋은 선택임. (4)

    Date2022.06.30 Category잡담 Bynana111 Views280 Votes2
    Read More
  21. No Image

    혹시나 밑에 알림 설정 안한 사람들 (5)

    Date2022.06.29 By유게대통령 Views101 Votes0
    Read More
  22. 혹시나 궁금해서 newli.net 들어가봤는데 (3)

    Date2022.07.15 Category잡담 By뉴리대장 Views94 Votes0
    Read More
  23. No Image

    혹시 핫딜 게시판은 안생기나 (1)

    Date2022.06.30 Category잡담 By과자 Views83 Votes1
    Read More
  24. No Image

    혹시 있으신분 댓글 달아보샘 (12)

    Date2022.07.03 Category잡담 By뉴리대장 Views105 Votes0
    Read More
목록
Board Pagination Prev 1 ... 7 8 9 10 11 12 13 14 15 16 ... 461 Next
/ 461