> 웹 프론트엔드 > CSS 튜토리얼 > 몸을 전환합니다

몸을 전환합니다

尊渡假赌尊渡假赌尊渡假赌
풀어 주다: 2025-03-22 10:30:31
원래의
465명이 탐색했습니다.

Body Toggle

I appreciate the clarity of this trick that Mikael Ainalem posted over on Reddit:

It’s a one-liner that toggles the class on the so you can mock up different states and toggle between them on click.

<body onclick="this.classList.toggle("active");">
로그인 후 복사

Could be on any element as well!

This can be a big thing. See “The Power of Changing Classes” as a case in point. Even if you aren’t much of a JavaScript person, classList is perhaps the one API you should know.

위 내용은 몸을 전환합니다의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿