javascript - 有没有办法使悬停区域大于图像?

标签 javascript html css image hover

我想知道是否有办法使悬停区域比图像大?

例如,我有一张 72px x 61px 的图片,当我将鼠标悬停在它上面时,它会变成另一张图片。我想知道的是我是否可以将鼠标悬停在图像之外但仍会触发图像的变化。

抱歉,如果这让您感到困惑,我尝试发布图片,但由于我刚刚注册,所以无法发布。

最佳答案

这是一个工作示例,只是悬停灰色彩色区域

.outer {
  border: 1px solid;
  padding: 60px;
  width: 300px;
  background-color: #ddd;
}

.outer:hover>img {
  content: url('http://docs.gimp.org/en/images/filters/examples/color-taj-sample-colorize.jpg');
}
<div class="outer">
  <img src="http://goo.gl/7VYJyX" />
</div>

关于javascript - 有没有办法使悬停区域大于图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31483189/

相关文章:

javascript - 隐藏 dc.dataTable 的组行

javascript - 取消上传 Angular-evalate

html - "Mashable"样式导航栏

html - 为什么我的某些 div 元素被水平截断了?

javascript - 动态 ajax 表单选择框自动填充

css - 为什么(禁用)颜色为 :inherit not follow disabled style? 的按钮

javascript - 如何在窗口调整大小时取消 Jquery 函数?

javascript - 需要时间绑定(bind)的 jQuery slider 插件

javascript - 使用javascript获取文件的修改时间戳

html - 表单验证失败后表单上的单选按钮无法正确呈现 - bootstrap