이론/jQuery

[jQuery] .hide() .show() .fadeOut() .fadeIn()

millfeel1298 2021. 10. 23. 21:10

구문

// 바로 숨김/보이기
$('선택자').hide() // display: none;
$('선택자').show() // display: block;

// 서서히 숨김/보이기 처리
// 애니메이션이라 모션 중첩을 멈춰줘야하기 때문에 .stop() 매서드와 함께 사용한다.
$('선택자').stop().fadeOut(시간) // display: none; opacity: 0;
$('선택자').stop().fadeIn(시간) // display: block; opacity: 1;

See the Pen Untitled by mill (@millfeel) on CodePen.