javascript - 如何在 bxSlider 中为图像添加叠加层

标签 javascript jquery css overlay bxslider

我需要向 bxSlider 中的图像添加深色叠加层,该叠加层会在鼠标悬停时消失,我该怎么做?

我看到的其他答案首先使用 0.7 的不透明度使图像变亮,但是有没有办法在图像上覆盖一个深色覆盖层,并在鼠标悬停时消失,类似于以下网站:http://www.renegadecraft.com/

谢谢!

最佳答案

您要找的是image tint

.tint:before {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,255,255, 0.5); /* color you want, in this case, probably black */
    -moz-transition: background .3s linear;
    -webkit-transition: background .3s linear;
    -o-transition: background .3s linear;
    transition: background .3s linear;
}

.tint:hover:before {
    background: none;
}

关于javascript - 如何在 bxSlider 中为图像添加叠加层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27348861/

相关文章:

jquery - 如果多次使用 $(this) ,我应该在 jQuery 中缓存它吗?

jquery - 使用jquery获取部分隐藏的div的实际高度

javascript - animationend 在 css 上触发但在 javascript 上不触发

javascript - 输入类型="file"javascript点击模拟

具有可选第一个参数的 Javascript 函数,但传递了第二个参数

java - 在JSP中使用自定义标签访问对象

html - 使用 css 定位图像的中心

javascript - 在数组中存储具有不同 id 的多个值 - php、javascript

javascript - 为什么我的功能只能在 Firefox 中使用?

html - 图标栏汉堡不起作用,只显示一条水平线