You must use regex to split the jQuery css result into the variables you are looking for.
var result = $('#element').css('text-shadow').match(/(-?\d+px)|(rgb\(.+\))/g) // result => ['rgb(30, 43, 2)', '-4px', '11px', '8px'] var color = result[0], y = result[1], x = result[2], blur = result[3];
This will return an array dividing the string text-shadow value into numbers with pixels and rgb values. This may help you in this particular case, but you may have to work on it to make it work for all possible cases of text-shadow
NOTE. The rgb(...) value is the first match in the array because it returns Firefox, Chrome, Safari and Opera, regardless of how you assigned it. IE can do it differently.
guzart
source share