Css Star-rating Html
Im following a tutorial on this page: http://www.henryhoffman.com/css-star-rating-tutorial.html where the HTML looks like this:
-
Solution 1:
I think you can just change your
a hrefs
into spans, seeing as the CSS already declared adisplay:block
this should work. Also in CSS changerating a
torating span
See if that helps.<ul class="rating"> <li><span>1</span></li>... .rating span { display:block;...
Solution 2:
This i similar, should get you on the right track. There are a couple of functions I do not include here, however the base is there for you to work with.
here is the fiddle: http://jsfiddle.net/n76My/5/
var index=1; $(".beeRating li").on({ mouseover: function() { if(index==1) { $(this).addClass('stop'); $("li").each(function(index,domEle) { $(domEle).css('opacity', '1'); if( $(this).hasClass('stop') ) { return false; } }) } }, mouseleave: function() { if(index==1) { $(this).removeClass('stop'); $("li").each(function(index,domEle) { $(domEle).css('opacity', '.25'); }) } }, click: function() { var rating = $(this).attr('id'); console.log(rating); index=0; $.ajax({ // do ajax request url: "/echo/json/" }).done(function() { alert("success"); index=1; // on done set the index as 1 }); } });
Post a Comment for "Css Star-rating Html"