Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在我的拖放游戏中设置可拖动对象的不透明度,但我真的不知道这些数字是什么意思......
有人可以解释一下我如何让它在悬停时真正引人注目吗?
$('.drag').hover( function() { $(this).stop().animate({ opacity: "0.8" }); }, function() { $(this).stop().animate({ opacity: "1" }); });
想一想 0 = 0%,1 = 100%。
因此,例如,如果您想要 50% 透明的东西,请将数字设置为0.5,如果您想要完全透明的东西,请选择0。值为 的东西0.9只会非常轻微地透明。
0.5
0
0.9
这也为 rgba 分叉,例如:
rgba(0, 0, 0, 0.5)
...将产生灰色,因为我们从黑色开始并使其 50% 透明(当然取决于背景)。
将悬停值设置为非常低的值,例如0.4,这很明显,您可以决定继续调整不透明度,直到悬停和正常状态很好地相互补充。
0.4