0

Im attempting to set a box-shadow color using tinycolor. I know I can use

$("CLASS").css("box-shadow", "VALUE");

But I would like to add the color by using tinycolor (a color manipulation framework) on an existing color variable.

I have tried :

$(".riHover").css("box-shadow", "inset 0px 0px 13px 0px tinycolor.lighten($('.Color').css('background-color'))"
);

But I don't think I am building the string properly. Any thoughts on what I am doing wrong?

Thanks in advance.

Jason Sperske
  • 29,816
  • 8
  • 73
  • 124
firepig
  • 61
  • 1
  • 1
  • 2
  • Should check this of http://stackoverflow.com/questions/3012899/box-shadow-is-there-a-box-shadow-color – Gaurav Apr 10 '13 at 16:20

2 Answers2

1

Why don't you make you life easier first by using a variable ? Something like this:

var shadowColor = tinycolor.lighten($('.Color').css('background-color'));
$(".riHover").css("box-shadow", "inset 0px 0px 13px 0px " + shadowColor);
Kaloyan
  • 7,262
  • 4
  • 32
  • 47
1

you need to remove the quotes for the javascript function be invoked...

$(".riHover")
  .css("box-shadow", 
       "inset 0px 0px 13px 0px "+ 
       tinycolor.lighten($('.Color').css('background-color'))
      );
PA.
  • 28,486
  • 9
  • 71
  • 95