Reputation:
I wish to change the text-shadow attribute of elements with javascript. As far as I know jquery css does not work with text-shadow.
Does anyone have any suggestions for dynamically changing text-shadow.
Thanks!
Upvotes: 2
Views: 17078
Reputation: 1
You can also place it inside an object.
({"text-shadow" : "#6374AB 20px 12px 2px"})
Upvotes: 0
Reputation: 1103
$("#text").hover(function() {
$(this).animate({textShadow: "#aaa 6px 6px 6px"});
}, function() {
$(this).animate({textShadow: "#ccc 3px 3px 3px"});
});
This and more at Alex Peattie's website: http://alexpeattie.com/projects/animate-textshadow/
Upvotes: 0
Reputation: 7215
Works for me (Chrome and FF, not IE).
Try using camelCase. When working with CSS properties in JavaScript, you have to remove the hyphen (for example, "background-image" would become "backgroundImage") and then set the properties.
So your code should read:
$('#bla').css('textShadow','#6374AB 20px -12px 2px');
Upvotes: 11