내 웹 앱의 스크롤을 최적화하려고합니다. 나는 많은 데이터를 가진 데이터 테이블을 가지고 있으며, 스크롤은 꽤 나 빠진다. 나는 데이터 테이블에 will-change: transform
을 추가했지만 position: fixed
인 테이블 헤더를 부러 뜨 렸습니다 (뷰포트로 스크롤 할 수 있도록 수정했습니다). 요소는 뷰포트와 함께 전혀 움직이지 않으며, 문서의 흐름에 갇혀 있습니다.변경 이유 : 불투명도가 고정 된 요소를 변경하는 것보다 다르게 처리합니다. 크롬에서 변환?
하지만 우연히 내가 will-change:opacity
을 사용하면 내 고정 헤더가 괜찮음을 발견했습니다. 누군가이 행동을 설명 할 수 있습니까? 나는 그들이 다르게 행동해야한다고 말하는 문서를 찾을 수 없었습니다.
여기 내가 말하는 것에 대한 예를 든 코드 펜입니다. 값 사이를 전환하고 파란색 div에서 스크롤합니다. 여기 https://codepen.io/bkfarns/pen/aLYgrN
도 펜의 기본 코드입니다 :
HTML :
CSS<div class="container">
<div class="fixed">should be position: fixed</div>
<div class="too-tall">div that is too tall</div>
</div>
:
이.container {
margin-left: 100px;
background-color: blue;
width:400px;
height:300px;
overflow: auto;
will-change: transform;//changing this to opacity fixes the issue
}
.fixed {
background-color: grey;
position: fixed;
margin-left: 150px;
margin-top: 100px;
}
.too-tall {
background-color: red;
width: 90px;
height: 600px;
}
지금 당장 사양을 파고 들지는 않겠지 만,'will-change : transform'은'transform'이'none'에 머 무르지 않아서 브라우저가 직접 스태킹을 생성하기 때문일 것 같습니다 당신이'transform : translate (0,0);'을 설정했을 때처럼, 당신의 엘리먼트로부터 컨텍스트를 가져올 수있다. https://stackoverflow.com/questions/15194313/transform3d-not-working-with-position-fixed-children을 참조하십시오. 실제 사양은 아니지만 [MDN의 기사에서이 paragraoh] (https://developer.mozilla.org/en-US/docs/Web/CSS/will-change#wikiArticle)의 마지막 글 머리 기호는이 정확한 효과에 대해 경고합니다. – Kaiido