我知道這個問題之前(here和here)詢問,但由於某種原因,我不能讓我的工作時使用相同的技術。基本上,當你將鼠標懸停在此,圖像懸停與CSS上顯示的圖像
你應該得到這樣的:
順便說一句,如果有這樣做沒有徘徊時加載新的圖像一個簡單的方法,請告訴我。
這裏是我的嘗試:
HTML
<div class="image">
<a href="#">
<img class="image" src="wp-content/themes/TheBullshitCollection/Images/bs-1.jpg">
</a>
</div>
CSS
.image {
width: 100%;
margin-right: 28px;
margin-bottom: 28px;
display: inline-block;
}
.image a:hover {
display:block;
background-image:url("/wp-content/themes/TheBullshitCollection/Images/bs-1.5.jpg");
margin-right:28px;
margin-bottom:28px;
transition: all 0.2s ease-in-out;
position: absolute;
z-index:1;
width: 100px;
height: 120px;
}
JS小提琴鏈接:
https://jsfiddle.net/ot8a5oba/
你可以看到是t他的寬度和高度也讓我感到困惑 - 我不確定如何確保它保持相同的尺寸,並且它出現在最上面。提前致謝!
是有些事情的照片嗎? –
@EdmundReed是啊 – HappyHands31