뒤로가기 행동시 이벤트 발생 기능
2024. 4. 24. 22:11
Frontend/HTML, CSS, DOM, jQuery
const browserPreventEvent = (event: () => void) => { history.pushState(null, "", location.href); event();}; useEffect(() => { history.pushState(null, "", location.href); window.addEventListener("popstate", () => { browserPreventEvent( '이벤트 함수'); }); return () => { window.removeEventListener("popstate", () => { browserPreventEvent('이벤트 함..
aria-label 의 설명과 SEO와의 관련성
2023. 12. 14. 22:48
Frontend/HTML, CSS, DOM, jQuery
aria-label은 웹 접근성을 향상시키기 위해 사용되는 중요한 속성 중 하나입니다. 이 속성은 HTML 요소에 추가되며, 화면 판독기와 같은 보조 기술을 사용하는 사용자들에게 해당 요소의 목적이나 내용을 설명하는 데 도움이 됩니다. aria-label을 사용함으로써 시각적으로 보이지 않는 요소에 대한 정보를 전달하고, 웹 페이지를 사용하는 데 있어서 더 나은 경험을 제공할 수 있습니다. aria-label은 주로 웹 접근성을 향상시키기 위한 목적으로 사용되며, 이는 주로 시각적으로 표현되지 않는 요소에 대한 정보를 제공하는 데 중점을 두고 있습니다. 그러나 aria-label은 검색 엔진 최적화 (SEO)와 직접적인 관련이 있는 것은 아닙니다. SEO는 주로 웹 페이지의 콘텐츠와 구조, 메타데이터, ..
node 최신버전(노드 최신버전) 설치했는데, 인식 못할때
2023. 10. 27. 22:09
Frontend/HTML, CSS, DOM, jQuery
n install lts 했는데, 으로 설치한 위치와 작동하는 위치가 달랐다 그래서 nvm ls 해도 최신버전을 못 찾았다 다음 명령어로 환경 변수를 수정할 수 있습니다. export PATH=$PATH:/usr/local/bin 다시 n install lts nvm ls 하면 최신 노드 버전이 설치된 것을 볼 수 있다
JS)소수점 있으면 toFixed 없으면, 그냥 보여주도록 하는 로직
2023. 10. 25. 23:01
Frontend/HTML, CSS, DOM, jQuery
const formatNumber = (number:any) => { const roundedNumber = Math.round(number * 100) / 100; // 소수점 둘째 자리까지 반올림 const isInteger = roundedNumber % 1 === 0; // 소수점이 없는지 확인 if (isInteger) { return roundedNumber.toString(); // 소수점이 없으면 그냥 반환 } else { return roundedNumber.toFixed(2); // 소수점이 있으면 둘째 자리까지 표시 } };