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.
我想知道如何使用 javascript / jQuery 获取不透明度参数。
例如:rgba(255,255,255,0.5)
我需要得到 0.5
谢谢
如果 "rgba(255,255,255,0.5)" 是字符串:
var rgba="rgba(255,255,255,0.5)"; var alpha=rgba.replace(/^.*,(.+)\)/,'$1')
试试这个函数链接,它定义了一个函数,它返回一个对象的 rgba 颜色。