この問題はChromiumバグ追跡システムに追加されました: https://bugs.chromium.org/p/chromium/issues/detail?id=1056331
私はこのマークアップを持っています:
const toggle = () => {
let el = document.getElementById("middle");
if (el.classList.value.includes("fade-in")) {
el.classList.remove("fade-in");
el.classList.add("fade-out");
} else {
el.classList.add("fade-in");
el.classList.remove("fade-out");
}
}
#wrap {
perspective: 2px;
perspective-Origin: center;
}
.has_height {
height: 50vh;
}
.fade-in {
opacity: 1;
transition: opacity 0.3s linear;
}
.fade-out {
opacity: 0;
transition: opacity 0.3s linear;
}
#img {
transform: translateZ(1px);
width: 200px;
height: 200px;
left: 35%;
position: absolute;
background-image: url("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMTEhUSExMVFhUWFxgVGBgXGBcYFhcWFxUYFhYXGhcYHSggGBolHRUVITEhJSkrLi4uFx8zODMtNygtLisBCgoKDg0OGhAQGi0fHx0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLf/AABEIALIBGwMBIgACEQEDEQH/xAAbAAACAwEBAQAAAAAAAAAAAAADBAIFBgEAB//EAD0QAAEDAgMGAwcEAQIFBQAAAAEAAhEDIQQxQQUSUWFxkYGhsRMiMsHR4fAGFEJSI2LxQ3KCkqIHFVOy0v/EABkBAAMBAQEAAAAAAAAAAAAAAAABAwIEBf/EACURAAICAgICAgIDAQAAAAAAAAABAhEDIRMxElEEQTJhIlJxFP/aAAwDAQACEQMRAD8Ar2YNwsSM58JHJTfhncu6di/f5LpXj+bPfoVZSMePzQjTfvCBYSnWMEeamM0eQUJVGOiIK8KZ4FPBs21VnhNiVHCXQwf6s+yF5PpCk1HtlDh3GHWOZ05qIEkEjSVpn7KpAwXknlA+qE/ZbT8LnA8wD9FTjkT5oGdD5APMItcc1du2M7RzfEEILtk1f6z0IKw4yX0aWSD+ylouzHJcp5Hr8laPwL2503D/AKT9EP2Efx8kr/Ru17FRmPzguV3x3EI/sSc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A/9k=");
}
<a onclick="toggle()">Toggle opacity</a>
<div id="wrap">
<div id="middle">
<div class="has_height"> <!-- REMOVE HEIGHT HERE -->
<div id="img"></div>
</div>
</div>
</div>
ここで、.wrap
にはperspective
があり、#img
にはtranslateZ
があり、ボタンをクリックすると画像がフェードインまたはフェードアウトするように切り替えることができます。
opacity
のフェードシーケンス中に何らかの理由で、中間要素(#middle
または.has_height
)にtranslateZ
が適用されている場合、height
は適用されません。
私はこれがなぜ起こっているのか本当に理解していません、そしてこの問題を説明するために [〜#〜] codepen [〜#〜] を作りました。
コードペンでクラスの高さを削除するとhas_height
は正常に機能します。しかし、高さを追加すると、snap
になり、フェードインが終了した後でのみtranslateZを適用します。
また、has_height
またはmiddle
に高さを適用したときに発生するだけでなく、height
- layout(Flexbox、Table、position:top、bottom、left、右0)
注:興味深いことに、これは最新のFirefoxでは正常に機能しますが、Chromeでは機能しません
編集:ChromeおよびWebkitタグを追加
編集2:発生すると思われることのGIFを作成しました: Gifyuのここを参照 これが最新のFirefoxでの動作方法です画像は最初から大きく(translateZのため)、フェードインおよびフェードアウトし、サイズは変わりません。
perspective
プロパティが設定された親要素があるとします。現在、opacity
が1
より小さい子要素は、translateZ
をレンダリングしません。これをchromeまたはWebkitブラウザのバグと見なす必要があるかどうかはわかりません。
したがって、opacity
とtranslateZ
を使用する必要がある場合は、perspective
をopacity
と同じ要素に追加します。
以下の例では、perspective
を処理する.middle
要素にopacity
を追加しています。
const toggle = () => {
let el = document.getElementById("middle");
if (el.classList.value.includes("fade-in")) {
el.classList.remove("fade-in");
el.classList.add("fade-out");
} else {
el.classList.add("fade-in");
el.classList.remove("fade-out");
}
}
#wrap {
/* perspective: 2px; */
/* perspective-Origin: center; */
}
#middle {
perspective: 2px;
perspective-Origin: center;
}
.has_height {
height: 50vh;
}
.fade-in {
opacity: 1;
transition: opacity 0.3s linear;
}
.fade-out {
opacity: 0;
transition: opacity 0.3s linear;
}
#img {
transform: translateZ(1px);
width: 200px;
height: 200px;
left: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bkV2xPugxGqKKbRlfzQcQ90/DN9D9kgCto9eiG926Zjhmu08Q0a39FGtQbUM7xjkTM/nJIA5faSFU16Jc7eY4t/0jLyAhExOGqU7h0gnIm4nidUzRpHdBIy6X5p9ALNpOHxeSeNQCR36KMjlPBLuxB3oAnp+XQMkHB8tLS5p5CPEE2SFfZ+HB3m/EOBJg+Ke3HOEENI4EQpNoxmGt6JqTXRlxT7M1U2VQflTvySbtjVmOmkA0aw6MuIK11akDBBmeYTFCnH8Y5k5rfIzPHEzNDZlV7CKlxa1vwop/T9MthzJHI2V/WoM4weI+ahTkGIBHUrPmzXiimP6fpboZBA5G4Xaf6fbTbEucOdv/qruvhW2Jz6wF1haBl80vOXsPFGabRZlBHddGBZz7q7NR82ZYqW+f6o8h0dwJne/NF3En/EenzXl5A32NURYeHoqSvVd7Zw3jHCTC4vJxEOi5IN7DNZ+qYe6OK6vLSBljgnnie6tcDmev0Xl5YkNBcc8hogkZZIe4CRIHZdXkwQGnTG6bD4uCZcfeZ1+RXl5JiDYoXCXIuF1eTEgdfJL0qY4DMaLy8gY8WCRYLtdojJeXkgO7PaL2Ci43d1+i8vIQiLLuumWCy4vIYCbXEvve+qnisiuryGMCz4J1nPXNHoLy8gA70jiD7wXF5CALSYM4EyUvthx92/8h6FeXkvsYmBOfL1TYaIy1K8vIYxrDmW3S2KeQbEhdXkfYj1N54nJANR3E915eTA/9k=");
}
<a onclick="toggle()" style="text-decoration: underline;cursor: pointer">Toggle opacity</a>
<div id="wrap">
<div id="middle" class="fade-in">
<div class="has_height"> <!-- REMOVE HEIGHT HERE -->
<div id="img"></div>
</div>
</div>
</div>