반응형
// Replace “.the-fixed-child” for a CSS selector
// that matches the fixed-position element:
const selector = '.the-fixed-child';
function findCulprits(elem) {
if (!elem) {
throw new Error(
'Could not find element with that selector'
);
}
let parent = elem.parentElement;
while (parent) {
const {
transform,
willChange,
filter,
} = getComputedStyle(parent);
if (
transform !== 'none' ||
willChange === 'transform' ||
filter !== 'none'
) {
console.warn(
'🚨 Found a culprit! 🚨\n',
parent,
{ transform, willChange, filter }
);
}
parent = parent.parentElement;
}
}
findCulprits(document.querySelector(selector));
728x90
반응형
'Languages > HTML||CSS' 카테고리의 다른 글
테이블이 꼼짝도 하지 않는다면 table-layout: fixed 를 조심하기 (0) | 2023.03.14 |
---|