html - Display message on hover using CSS next to Star Rater unordered list -


i trying show unique message right of star rater when each star hovered over. messed around tooltips follow mouse, want message fixed. tried looking @ yelp's code looks using css. hoping simple css solution, rather using javascript or jquery. if has solution or pointer appreciate it. thanks.

here code:

<ul class="star-rating"> <li class="current-rating" style="width:'.$average_rating.';"></li> <li><a href="#" title="1" class="one-star tooltip" onclick="updatestarrating(this.title)">1</a> <p class="message">terrible!</p> </li> <li><a href="#" title="2" class="two-stars tooltip" onclick="updatestarrating(this.title)">2</a> <p class="message">not good!</p></li> <li><a href="#" title="3" class="three-stars" onclick="updatestarrating(this.title)">3</a> <p class="message">pretty good.</p></li> <li><a href="#" title="4" class="four-stars" onclick="updatestarrating(this.title)">4</a> <p class="message">almost perfect!</p></li> <li><a href="#" title="5" class="five-stars" onclick="updatestarrating(this.title)">5</a> <p class="message">perfect!</p></li> </ul>  .star-rating ul li div{display:none; background:white; opacity:.5; position:absolute;}  .star-rating, .star-rating a:hover, .star-rating a:active, .star-rating a:focus, .star-rating .current-rating{ background: url(../images/star_01_white.png) left -1000px repeat-x; } .star-rating{ position:relative; width:110px; height:19px; overflow:hidden; list-style:none; margin:0; padding:0; background-position: left top; } .star-rating li{ display: inline; } .star-rating a,  .star-rating .current-rating{ position:absolute; top:0; left:0; text-indent:-1000em; height:19px; line-height:19px; outline:none; overflow:hidden; border: none; } .star-rating a:hover, .star-rating a:active, .star-rating a:focus{     background-position: left bottom; } .star-rating a.one-star{     width:20%;     z-index:6; } .star-rating a.two-stars{     width:40%;     z-index:5; } .star-rating a.three-stars{     width:60%;     z-index:4; } .star-rating a.four-stars{     width:80%;     z-index:3; } .star-rating a.five-stars{     width:100%;     z-index:2; } .star-rating .current-rating{     z-index:1;     background-position: left center; }    

here example how works. using "+" css selector.

http://jsfiddle.net/hades/

.five-stars:hover + .message{ display:block !important; z-index:10;} 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -