简体   繁体   中英

How get opacity param in rgba using javascript

I wanna know how i can get the opacity param using javascript / jQuery.

For exemple : rgba(255,255,255,0.5)

I need to get 0.5

Thanks

In case if "rgba(255,255,255,0.5)" is string:

var rgba="rgba(255,255,255,0.5)";
var alpha=rgba.replace(/^.*,(.+)\)/,'$1')

试试这个函数链接 ,它定义了一个函数,它返回一个对象的rgba颜色。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM