Hey folks, Here is a site with some JavaScript that does EXACTLY what I want it to do. The problem is that I'm going to want to apply this same script to multiple images/spans. If I just list multiple elements before the .rotate I'm afraid I'll see the rotation of all of my images when I hover over one. I also don't want to write a separate function for each element because that's just clunky. I was hoping for some solutions to clean this up so I can apply my script to any element. Thanks, Corey
P.S. I know this doesn't work in IE except for 9 and right now I'm ok with that.
I would add a class name to all of the items, something like "menu" then change the id's inside the function to $(this), then for the span, use $(this).next(). So the modified code would look like this:
Well that kind of worked. Everything is independent but now I have a strange rotation on the second picture. I've updated the site so the link is still good. Also, what does .next do?
"Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector."
Here is a site with some JavaScript that does EXACTLY what I want it to do. The problem is that I'm going to want to apply this same script to multiple images/spans. If I just list multiple elements before the .rotate I'm afraid I'll see the rotation of all of my images when I hover over one. I also don't want to write a separate function for each element because that's just clunky. I was hoping for some solutions to clean this up so I can apply my script to any element.
Thanks,
Corey
P.S. I know this doesn't work in IE except for 9 and right now I'm ok with that.
$(this), then for the span, use$(this).next(). So the modified code would look like this:"Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector."
source: http://api.jquery.com/next/