当鼠标悬停在图层上时,我希望图像变暗一点(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. flex,当鼠标悬停在按钮上时,更改鼠标悬停/跳出时的按钮图像
- 3. 当鼠标悬停在按钮上时更改图像
- 4. 将鼠标悬停在按钮上时显示图像
- 5. 当鼠标悬停在图像上时显示按钮(rails image_tag)
- 6. 图像,鼠标悬停,按钮出现
- 7. 图片上鼠标悬停
- 8. 鼠标/鼠标悬停图像变化父图片src
- 9. 当鼠标悬停在图标上时,按钮文字模糊
- 10. 将鼠标悬停在图片上
- 11. 将鼠标悬停在图片上
- 12. 将鼠标悬停在每个图像上的按钮
- 13. 在FMX XE2按钮上的鼠标悬停图像
- 14. 将鼠标悬停在图像上时删除图像标题
- 15. 在图像鼠标悬停变焦
- 16. 在鼠标悬停上移动图像
- 17. 将鼠标悬停在图像上
- 18. 在鼠标悬停时放大图像
- 19. 在d3鼠标悬停变暗rect/circle
- 20. 当鼠标悬停在按钮上时,按钮添加按钮
- 21. 如何在鼠标悬停并且鼠标远离按钮时将图像放置在primefaces按钮上?
- 22. 将鼠标悬停在另一图像上时显示图像
- 23. 鼠标悬停在图像上时更改图像
- 24. 在悬停上更改图片并单击,在鼠标悬停时从图片上保留图片
- 25. 鼠标悬停在图像上时可点击图标显示
- 26. 在缩略图按钮上的鼠标悬停事件上应用图像?
- 27. 鼠标悬停图像幻灯片
- 28. jQuery的图片交换为鼠标悬停和鼠标按下
- 29. 按钮在鼠标悬停上移动
- 30. 获取按钮鼠标悬停在图像
如果你不知道该怎么做,你的第一个问题是你不懂HTML,CSS或JavaScript。为了解决这个问题,你首先需要学习。在互联网上有很多教程,使用您选择的搜索引擎找到一个并开始。我们不是一个免费的编码服务,我们只是在这里帮助您解决您的编程问题(一旦您已经付出努力并且能够清楚地传达您在实施自己的解决方案时面临的问题)。顺便说一句,你已经成为这个网站的成员8个月,问了14个问题,仍然不知道网站的规则? –
欢迎来到SO。请访问[帮助],看看有什么和如何问。提示:不是elance.com – mplungjan
从这些(http://tympanus.net/Tutorials/CaptionHoverEffects)学习并自己尝试,如果仍然卡住粘贴代码,我们将帮助您使用它 –