I want to get 4 variables when I click on a span that have the CSS3 text-shadow propriety. So for a css propriety of text-shadow: -4px 11px 8px rgb(30, 43, 2);, my code should be:
$("#element").click(function () {
var text-shadow = $("#element").css("text-shadow")
});
Would it be possible to get it split like:
var y = "-4px";
var x = "11px";
var blur = "8px";
color = "rgb(30, 43, 2)";
I need to somehow split the first variable to get this data.
Thanx
You should use regular expression to split the result of jQuery css into the variables you are looking for.
This will return an array splitting the
text-shadowstring value into numbers with pixels and rgb values. It can help you in this particular case, but you’ll probably need to work on it some more to get it working for all the possible cases oftext-shadowNOTE: The
rgb(...)value is the first match in the array because, that is the way Firefox, Chrome, Safari and Opera return it, independently of how you assign it. IE might do it differently.