【发布时间】:2018-09-11 20:54:01
【问题描述】:
我试图在悬停按钮时触发鼠标悬停更改以填充 svg 圆形背景颜色。我做不到。
.position-orange-circle { position: absolute; margin-top: 100px; }
.position-btn { background-color: #ffbb11; height: 41px; width: 130px; border: none; border-radius: 8px; font-size: 1em; font-weight: 600; cursor: pointer; -webkit-transition-duration: 0.4s; transition-duration: 0.4s;}
.position-btn:hover svg circle { background-color: #231f20 !important; color: #ffbb11 !important; border: #9c7002 solid 1px; fill: #ffbb11;}
<svg height="150" width="150" class="position-orange-circle">
<circle cx="60" cy="60" r="50" stroke="#ffbb11" stroke-width="5" fill="white"/>
</svg>
<div class="btn-position">
<button class="position-btn">Apply now</button>
</div>
【问题讨论】:
-
什么都没有发生,因为你没有
chbgJavaScript 函数,因此chbg('red')只会抛出Uncaught ReferenceError: chbg is not defined。 -
@ObsidianAge - 除非必须,否则我不想使用 JS?
-
对不起,我在 stackoverflow 上发帖之前正在测试 JS。那对我不起作用。