Search code examples
jquerycssstylesheet

How to make rba feature work during box-shadow editing with jquery?


I'm trying to make this:

$(".selector").css({
  "box-shadow": "4px 4px 4px 4px rgba(#000, 0.3)",
 });

but it is not working and when I remove the 'rgba' and add a normal color (just #000 for example) it works nice, I need to add some opacity to the shadow but it doesn't work.


Solution

  • #000 is hex.

    If you provide rgb values correctly it works for me!

     $(".selector").css({
       "box-shadow": "4px 4px 4px 4px rgba(0, 0, 0, 0.3)",
     });
    

    https://jsfiddle.net/ns60fh4y/