My apologies if a similar question has already been asked.
I've got a class of links, each with an image and text.
<a class="link">
<img src="//filepath">
link text
</a>
When the user hovers over one of these links, I'd like to apply a rotate transformer to the image only. This presents me with a problem, because I can't just use css to execute this -- if I apply :hover { rotate } to the images within the link, then this effect will only occur when the user hovers over the image, but not the rest of the link.
I foolishly thought these lines of JS would save me:
$('a.link').hover(function(){
$('a.link img').css(
{'-webkit-transform':'rotate(40deg)'}
);
});
Of course, the problem is, this applies the transformer to the entire class when the user hovers over a single link. Also, the change doesn't reverse when the user stops hovering over the link.
I have started a fiddle, but am at a loss of how to solve this. Any help would be greatly appreciated.