我的網站上有一個圖標。CSS:顯示多個圖像的懸停
當我將鼠標懸停在第一個圖標上時,我想將圖標更改爲4張不同的圖像。所以我知道如何在regilar圖像之間切換到yellow0.png,但我如何繼續下一個(在說半秒之後..)
懸停 - > hide 2.png - > show yellow0.png - >隱藏yellow0 - >顯示yellow1 - >隱藏yellow1 - >顯示yellow2 - > ECT
HTML:
<a href="<?php echo get_page_link(6); ?>" class="mobile-link">
<img src="<?php echo $themedir;?>/images/2.png" class="mobile-icon animated swing">
<img src="<?php echo $themedir;?>/images/yellow0.png" class="animated swing mobile0" >
<img src="<?php echo $themedir;?>/images/yellow1.png" class="animated swing mobile1" >
<img src="<?php echo $themedir;?>/images/yellow2.png" class="animated swing mobile2" >
<img src="<?php echo $themedir;?>/images/yellow3.png" class="animated swing mobile3" >
</a>
CSS:
.mobile0{
display: none;
}
.mobile1{
display: none;
}
.mobile2{
display: none;
}
.mobile3{
display: none;
}
.mobile-link:hover .mobile-icon{
display: none;
}
.mobile-link:hover .mobile0{
display: block;
}
編輯:
這是一個小提琴! http://jsfiddle.net/6kdvsthx/
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_animations – Quentin
使用jQuery的這個 –
我想如果要更換圖像,而無需懸停只使用CSS –