[英]How to darken background when hovering on image
I have created a jQuery hover button. 我创建了一个jQuery悬停按钮。 When you hover over the box, a jQuery button appears.
将鼠标悬停在框上时,将显示一个jQuery按钮。 However, it doesn't work.
但是,它不起作用。 Can someone show me how to add a black background to the box when hovered over?
有人可以向我展示如何将鼠标悬停在框上时添加黑色背景吗?
The objective is to; 目的是
When rolling over the box, it displays "chart it btn" 将鼠标悬停在框上时,它会显示“ chart it btn”
When rolling over the box, the box gets a black background. 将鼠标悬停在框上时,框会变成黑色背景。
/* CHART IT BTN ON POTS
===================================================================*/
$(".btn-trigger").hover(function () {
$(this).find(".charthis-btn").show();
}, function () {
$(this).find(".charthis-btn").hide();
})
I need the image that is shown to darken black with an opacity of 50% when rolled over. 我需要显示的图像,当鼠标滑过时显示为具有50%不透明度的黑色。
$(".display-box").hover(function () {
$(this).find(".charthis-btn").show();
}, function () {
$(this).find(".charthis-btn").hide();
})
$(".charthis-btn").on('mouseenter',function(){
$(".display-box img").css('opacity','0.5');
})
$(".charthis-btn").on('mouseout',function(){
$(".display-box img").css('opacity','');
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.