我期待CSS動畫背景從大小background-size: cover;
到background-size: 120%
懸停。我不能將背景從100%開始,因爲它開始在不同的設備/顯示器上垂直重複。但是,在這種情況下,transition:.5s;
會停止任何類型的動畫。任何解決方法?Animate背景大小:縮放到背景大小:110%
代碼如下所示:
HTML
<div class="desktop-signs">
<div class="image-box">
<div class="col-md-4 block-service" id="block-illustration">
<h2>ILLUSTRATION & ANIMATION</h2>
</div>
</div>
<div class="image-box">
<div class="col-md-4 block-service" id="block-website">
<h2>WEBSITE DEVELOPMENT</h2>
</div>
</div>
<div class="image-box">
<div class="col-md-4 block-service" id="block-game">
<h2>GAME & APP DEVELOPMENT</h2>
</div>
</div>
</div>
CSS
.__hero-container #services .block-service {
height: 800px;
background-image: url('../images/blockillustration.jpg');
background-size: cover;
text-align: center;
color: #fff;
background-position: center;
opacity: 1;
-o-transition:.5s;
-ms-transition:.5s;
-moz-transition:.5s;
-webkit-transition:.5s;
transition:.5s;
}
.__hero-container #services .block-service:hover {
background-size: 110%;
opacity: 0.8;
cursor: pointer;
}
過渡添加到:懸停爲好,也許? – Kyle
'background-repeat:no-repeat'和'background-size:100%'? – Roberrrt
不幸的是,將轉換添加到:hover元素不起作用:( 而我不能使用'background-repeat:no-repeat',因爲我得到的圖像不重複的黑色邊框。大小動態基於瀏覽器寬度使用Bootstrap! –