gpt4 book ai didi

css - transitioned book 在 firefox 和 microsoft edge 中不起作用 - 为什么以及如何修复它?

转载 作者:行者123 更新时间:2023-11-28 15:31:25 25 4
gpt4 key购买 nike

过渡和转换似乎在 firefox 中对我来说工作不正常,我为所有内容添加了 -moz- 前缀,但它似乎对使其更具功能性的影响为零。我有一本书,悬停在上面时会打开,但在 fire fox 中,这本书不会一直打开,而是在鼠标移开之前关闭。书中未使用的过渡和变换似乎有效,似乎书中的那些才是问题所在。至于 Microsoft Edge,它可以正常工作,但背景图像、伪元素之前的 abd 和我在上面的 div 没有显示。图书封面在 Microsoft Edge 上只是空白。有更多经验的人了解这里的问题吗?它在 chrome 中运行良好,但在 firefox 中运行不正常。

https://jsfiddle.net/ma2u65o0/

 //book css snippet
.book-front{
position: relative;
transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-origin: left;
-moz-transform-origin: left;
transition: transform 1s ease-in-out 0s;
-moz-transition: transform 1s ease-in-out 0s;
box-shadow: 0px 3px 5px 2px rgba(0,0,0,.5);
perspective: 400px;
perspective-origin: -200px;
}
.front-of-book-front{
background-image: url("images/mainCover.jpg");
background-repeat: no-repeat;
background-size: cover;
background-position: 47%;
backface-visibility: hidden;
-moz-backface-visibility: hidden;
}

最佳答案

backface-visibility:hidden 添加到您的 .front-of-book-front 使其在打开和关闭操作后透明。

此外,我建议您使用 3d 变换进行硬件加速。

更新后的 CSS:

.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book{
width: 100px;
height: 160px;
position: relative;
perspective: 800px;
}
.book{
margin: 52px auto;
transition: transform 1s ease-in-out 0s;
}
.book-front{
position: relative;
transform-style: preserve-3d;
transform-origin: left;
transition: transform 1s ease-in-out 0s;
box-shadow: 0px 3px 5px 2px rgba(0,0,0,.5);
perspective: 400px;
perspective-origin: -200px;
}
.front-of-book-front{
background-image: url("images/mainCover.jpg");
background-repeat: no-repeat;
background-size: cover;
background-position: 47%;
}
.front-of-book-front:before{
content: "Seraph Chronicles: Evangelion";
text-shadow: 2px 2px 1px rgba(0,0,0,.5);
font-size: .5em;
line-height: 15px;
color: white;
width: 119px;
height: 15px;
background-color: rgba(255,165,0,.5);
position: absolute;
text-align: center;
transform: translate3d(8px,93px,0) rotateZ(90deg);
}
.front-of-book-front:after{
content: "";
width: 75px;
height: 12px;
background-color: rgba(255,165,0,.5);
position: absolute;
transform: translate3d(0px,19px,0);
}
.bar{
width: 80px;
height: 8px;
background-color: rgba(0,0,0,.8);
font-size: .3em;
color: white;
text-align: right;
transform: rotateZ(90deg) translate3d(36px,-45px,0);
}

.bar p{
padding: 2px 3px 0 0 ;
display: block;
}
.back-of-book-front{
backface-visibility: hidden;
background-color: rgb(240,234,214);
transform: rotateY(180deg);
position: absolute;
top: 0;
}
.book:hover .book-front {
transform: rotateY(-180deg);
}
.book:hover{
transform: rotateZ(10deg);
}

.book-back{
position: absolute;
top:0;
background-color: rgb(240,234,214);
z-index: -1;
box-shadow: 3px 3px 5px 0 rgba(0,0,0,.5);
text-align: justify;
}

.book-back p{
font-size: .3rem;
margin: 2.9em 1.9em;
}

@media screen and (min-wdith:400px){

.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book{
width: 113px;
height: 180px;
}

.front-of-book-front:before{
width: 133px;
height: 17px;
transform: translate3d(8px,105px,0) rotateZ(90deg);
}

.front-of-book-front:after{
width: 83px;
height: 14px;
transform: translate3d(0,21px,0);
}
.bar{
width: 95px;
height: 10px;
background-color: rgba(0,0,0,.8);
font-size: .3em;
color: white;
text-align: right;
transform: rotateZ(90deg) translate3d(42px,-45px,0);
}
.book-back p{
font-size: .4rem;
margin: 2.9em 1.9em;
}
.book-side{
width: 176px;
height: 10px;
top:-3px;
}
}

@media screen and (min-width:860px){
.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book{
width: 200px;
height: 320px;
}
.front-of-book-front{
perspective: 200px;
}
.front-of-book-front:before{
width: 234px;
height: 37px;
transform: translate3d(11px,185px,0) rotateZ(90deg);
font-size: 1em;
line-height: 37px;
}

.front-of-book-front:after{
width: 146px;
height: 26px;
transform: translate3d(0,32px,0);
}
.bar{
width: 172px;
height: 23px;
background-color: rgba(0,0,0,.8);
font-size: .3em;
color: white;
text-align: right;
transform: rotateZ(90deg) translate3d(74px,-82px,0);
font-size: .7em;
}
.bar p{
display: block;
padding: 12px 5px 0 0;
}
.book-side{
width: 312px;
height: 10px;
top:-1px;
left: -5px;

}
.book-back p{
font-size: .7em;
margin: 3.3em 2.3em;
}

关于css - transitioned book 在 firefox 和 microsoft edge 中不起作用 - 为什么以及如何修复它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44652176/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com