어제에 이어 HTML CSS 기본 세팅


aniBox의 자식div 너비(1200px)를 변수 지정! 값이 바뀌어도 일일이 수정할 필요 없음
const wdata = $('.aniBox > div').width();



fade 시나리오를 먼저 생각하라 (지하철같은 좌우형과 달리! 빨간박스 3개 겹쳐짐)

<style>
.aniitem{
position: absolute; /* left: 0 top 0 위치로 이동 */
left: 0;
top: 0;
width: 1200px;
height: 300px;
background-color: red;
color: white; font-size: 50px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>

클래스 '.show'가 추가되면

↓
그러므로, 클래스 '.show'를 add / remove 하는 제이쿼리를 삽입해야 한다!
↓
포개놓은 div 영역 123이 번갈아가며 등장한다!

요소검사 시 .show가 add / remove 된다

.aniitem{ position: absolute; width: 100%; height: 100%; }
<style>
.banner{
position: relative; /* 아이템이 포개져(fade)있기 때문에 */
너비 : 1200px
높이 : 300px
margint : 0 auto; /* 가운데 정렬 */
}
.aniBox{ /* 엄마 너비값 1000000px... 걍 뺌! */ }
.aniitem{
position: absolute; /* 위치를 부모 기준으로 지정!! */
left: 0;
top: 0;
width: 100%; /* 포지션:abs / 위치를 부모 기준으로 지정!! */
height: 100%; /* 포지션:abs / 부모 너비/높이를 가져오겠다 */
}
</style>





최적화를 위한 식