當鼠標懸停在圖層上時,我希望圖像變暗一點(Overlay?)。然後,當鼠標懸停時,圖片中的按鈕應該出現,如果鼠標懸停在一個按鈕上,它應該變成紅色(如圖片),並且圖像描述文本應該出現在按鈕下方(如圖片),然後if一個按鈕被點擊它應該帶我們到一個新的URL(說,如果按鈕被點擊,它將我們帶到www.google.com),任何人都可以提供任何代碼?我不知道該怎麼做。在鼠標懸停和圖像變暗時在圖片上插入按鈕
-5
A
回答
2
我覺得這是你want.try這算什麼。我只關心你的主要觀點。這將對你有用。
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
</head>
<style type="text/css">
body{
margin: 0;
padding: 0;
}
div.contain{
width: 1000px;
height: 667px;
border: 2px solid black;
margin: 100px;
margin-top: 10px;
background-image: url(https://dancingaspen.files.wordpress.com/2015/09/coffee-shop-mug.jpg);
}
div.mask{
width: 100%;
height: 100%;
background-color: black;
position:relative;
opacity: 0;
}
.zoom{
width: 150px;
height: 50px;
color: white;
font-size: 35px;
background-color: red;
position: absolute;
top: 300px;
left: 300px;
border: 2px solid white;
border-radius: 10px;
display: none;
text-align: center;
font-size: monospace;
padding-top: 15px;
text-decoration: none;
}
.description{
position: absolute;
width: 70%;
height: 30%;
top:410px;
left: 12%;
font-size: 35px;
color: white;
font-family: zapfino;
text-align: center;
display: none;
}
</style>
<body>
<div class="contain">
<div class="mask"></div>
<a href="#" target="_blank" class="zoom">ZOOM</a>
<div class="description">your description here</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$(".contain").mouseenter(function(){
$(".mask").animate({opacity:0.5},1000);
$(".zoom").fadeIn(1500);
$(".description").fadeIn(1500);
});
$(".contain").mouseleave(function(){
$(".mask").animate({opacity:0},1000);
$(".zoom").fadeOut();
$(".description").fadeOut();
});
});
</script>
</body>
</html>
只需複製,粘貼和運行。
0
使用'懸停'設置可以使用直線css完成變暗圖像。 選擇你的照片(或最好是包含圖像的div)並設置div:將光標懸停在較低的不透明度上,如不透明度:0.5;
如果你想使圖像變暗,而無需一個黑暗的背景,你可以設置圖像作爲div的背景 enter code here
enter code here
enter code here
.parent {背景:「圖像/ image.jpg的」;} enter code here
.child {background-color:black; opacity:0;} enter code here
.child:hover {opacity:0.7;}
相關問題
- 1. 當鼠標懸停在圖像上時,像按鈕出現
- 2. 當鼠標懸停在按鈕上時更改圖像
- 3. 當鼠標懸停在圖像上時顯示按鈕(rails image_tag)
- 4. 圖像,鼠標懸停,按鈕出現
- 5. 圖片上鼠標懸停
- 6. 鼠標/鼠標懸停圖像變化父圖片src
- 7. 當鼠標懸停在圖標上時,按鈕文字模糊
- 8. 將鼠標懸停在每個圖像上的按鈕
- 9. 將鼠標懸停在另一圖像上時顯示圖像
- 10. 鼠標懸停在圖像上時更改圖像
- 11. 鼠標懸停在圖像上時可點擊圖標顯示
- 12. 在縮略圖按鈕上的鼠標懸停事件上應用圖像?
- 13. 獲取按鈕鼠標懸停在圖像
- 14. 將鼠標懸停效果的按鈕,圖像在XAML
- 15. 如何在鼠標懸停在圖像上時在圖像上顯示縮放按鈕
- 16. 在Aframe中將鼠標懸停在圖像和標題上
- 17. 圖片庫變暗按鈕
- 18. 如何使鼠標懸停在按鈕上時顯示圖像(無繼承)
- 19. 如何在鼠標懸停在圖像中時顯示圖像?
- 20. 鼠標懸停時的jQuery圖像滑塊和鼠標懸停時的重置
- 21. jQuery:當您將鼠標懸停在圖像上時,淡入圖像
- 22. 將鼠標懸停在圖像變化的另一個圖像
- 23. 懸停圖像? (鼠標)
- 24. 鼠標懸停改變圖像
- 25. Gridview ImageButton改變鼠標懸停和鼠標移動的圖像
- 26. 將鼠標懸停在圖片上的主動輸入選項
- 27. 在鼠標懸停時淡入淡出的圖片
- 28. 在鼠標懸停上更改圖像x和y座標
- 29. 如何讓按鈕上的圖像在鼠標懸停上顯示? WPF
- 30. 更改鼠標懸停和鼠標懸停在CSS中的圖像
如果你不知道該怎麼做,你的第一個問題是你不懂HTML,CSS或JavaScript。爲了解決這個問題,你首先需要學習。在互聯網上有很多教程,使用您選擇的搜索引擎找到一個並開始。我們不是一個免費的編碼服務,我們只是在這裏幫助您解決您的編程問題(一旦您已經付出努力並且能夠清楚地傳達您在實施自己的解決方案時面臨的問題)。順便說一句,你已經成爲這個網站的成員8個月,問了14個問題,仍然不知道網站的規則? –
歡迎來到SO。請訪問[幫助],看看有什麼和如何問。提示:不是elance.com – mplungjan
從這些(http://tympanus.net/Tutorials/CaptionHoverEffects)學習並自己嘗試,如果仍然卡住粘貼代碼,我們將幫助您使用它 –