-3
A
回答
0
您可以使用JavaScript做。如果您不知道如何使用JavaScript,請參閱下面的代碼。
<html>
<head>
<title>Title</title>
<script type="text/javascript>
function myFunction(){
document.getElementById('img').src = "down.jpg";
}
</script>
<body>
<img src="right.jpg" id="img" onclick="myFunction();"/>
</body>
</html>
享受:d
正如你可以看到,我們在使用它的id的js獲取元素並改變其src屬性並將其設置爲你的另一幅圖像。您可以根據自己的需要更改點擊的事件。您可以使用ondblclick通過雙擊觸發該功能。^-^
0
這可能會幫助你@ pbrc1995 :)
function myFunction(x) {
x.classList.toggle("change");
}
.container {
display: inline-block;
cursor: pointer;
}
.bar1, .bar2, .bar3 {
width: 35px;
height: 5px;
background-color: #333;
margin: 6px 0;
transition: 0.4s;
}
.change .bar1 {
-webkit-transform: rotate(-45deg) translate(-9px, 6px) ;
transform: rotate(-45deg) translate(-9px, 6px) ;
}
.change .bar2 {opacity: 0;}
.change .bar3 {
-webkit-transform: rotate(45deg) translate(-8px, -8px) ;
transform: rotate(45deg) translate(-8px, -8px) ;
}
<p>Click on the Menu Icon to transform it to "X":</p>
<div class="container" onclick="myFunction(this)">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
</div>
0
既然你不是在問一個JavaScript解決方案,這裏是一個沒有它。
div.arrow {
width:33px; height:30px;
background:url('https://i.stack.imgur.com/yMatp.png');
}
div.arrow:active{
width:51px; height:26px;
background:url('https://i.stack.imgur.com/M3Bew.png');
}
<div class="arrow"></div>
相關問題
- 1. CSS麪包屑箭頭指向左
- 2. 「Ctrl +左箭頭」和「Ctrl +右箭頭」的八進制代碼
- 3. CSS箭頭
- 4. 雙箭頭CSS
- 5. CSS盒除箭頭外有箭頭
- 6. JSlider箭頭指向左側?
- 7. 我該如何用html和css編碼這樣的箭頭?
- 8. 如何僅使用HTML和CSS創建UP箭頭?
- 9. 在懸停#leaderboard上,向#左箭頭和#右箭頭添加一個類
- 10. 創建箭頭CSS和背景圖像
- 11. 旋轉的CSS箭頭和JavaScript切換
- 12. css放和箭頭指向圖像?
- 13. 使用CSS在僞元素前後創建左箭頭
- 14. 使一個小箭頭CSS
- 15. 使用CSS的箭頭
- 16. 純CSS箭頭幫助
- 17. jquery tablesorter CSS箭頭圖標
- 18. 使用CSS製作箭頭
- 19. 居中的CSS箭頭
- 20. 帶邊框的CSS箭頭
- 21. CSS中的小箭頭
- 22. 對齊css箭頭框
- 23. 帶投影的Css箭頭
- 24. 動畫雙箭頭 - CSS
- 25. 圓形箭頭與CSS
- 26. CSS創建消息箭頭
- 27. CSS下拉導航/箭頭
- 28. 的CSS選擇框箭頭
- 29. 使用左右箭頭(HTML + JS)設置焦點
- 30. Css導航箭頭在頁面左側和右側垂直持久
你不能這樣做,只用HTML和CSS。由於這涉及點擊,您還需要js/jQuery。 –