I have a web app that has a list of user comments. I want extra options for these comments (vote, reply, etc..) to appear only when the comment itself is mouseover-ed
The best example of what I am looking for would be a youtube video:
http://www.youtube.com/watch?v=s2VzLn6DMCE&ob=av3e
When you go to the comments the options (reply, vote up/down) are only displayed when that specific comment is rolled-over. How is this achieved? Is it simply a matter of using jquery (or similar javascript library) and displaying hidden divs?
Edit:
Ok so the element I am rolling over is complicated that I need to do it with javascript. I’m using rails, so prototype it is! Each of the individual list items has a unique id, but I have no idea how to pass this id variable into the prototype! This way it can display/hide the elements from a specific list item. How do I go about doing this?
CSS is the best way, in my opinion. Here’s a vertical way:
HTML:
CSS:
And here’s a horizontal way, with the same HTML:
CSS:
A little creative margin/padding work and you can get different results.
Also, you can use
first-childand/or next sibling selectors, or others.