我的「放大效應」使用這樣一個div工作:使背景圖片縮放,而不是在鉻工作
<div class="highlight" style="background-image:url(image); background-position: 65% 50%;">
<div class="content" style="margin-top: 150px">
<h3>Blabla<br>Blablablablabla<br></h3>
<p class="home5050">Blablablablabla.</p>
<a class="btn btn-photo" href="urlsomething" style="color: black; background-color: white;">Blabla <span class="btnArrow">><span></span></span></a>
</div>
</div>
和CSS這樣的:
.highlight {
display: block;
position: relative;
/*min-height: 800px;*/
min-height: 520px;
background-position: center center;
background-repeat: no-repeat;
/*padding-top: 200px;*/
padding-top: 80px;
/*background-size: cover;*/
}
.highlight:before {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,.25);
content: "";
}
.highlight{
position: relative;
height: 800px;
cursor: pointer;
background-size: auto 110%;
background-position: center center;
-moz-transition: background-size 3s ease;
-webkit-transition: background-size 3s ease;
transition: background-size 3s ease;
}
.highlight:hover{
background-size: auto 130%;
background-color:rgba(0,0,0,0.4);
-moz-transition: background-size 3s ease;
-webkit-transition: background-size 3s ease;
transition: background-size 3s ease;
}
.highlight:before{
content: ' ';
position: absolute;
left: 0; top: 0;
right: 0; bottom: 0;
background-color:rgba(0,0,0,0.4);
-moz-transition: background-color 3s ease;
-webkit-transition: background-color 3s ease;
transition: background-color 3s ease;
}
.highlight:hover:before{
background-color:rgba(0,0,0,0.8);
-moz-transition: background-color 3s ease;
-webkit-transition: background-color 3s ease;
transition: background-color 3s ease;
}
我發現更多的CSS在主題中,使參考突出顯示,也許有一些問題呢?這在Firefox中工作,但現在不在Chrome中。
https://jsfiddle.net/1v3epk6b/2/
是的,但過渡效果不觸發尚未 – Genaut
他們爲我做的。每當我將鼠標移到背景上時,它都會放大。 –
是的,但不會在3秒內產生過渡效果,圖像立即放大,對不起我的英語 – Genaut