jquery stars rating control -



jquery stars rating control -

im trying create functionality described below:

ive got 5 images of stars. on server decide image color should displayed in each image. if rating computed on server 3 first 3 stars yello , lastly 2 grey.

i accomplish functionality (using jquery). when user hovers star 1 , previous colors changed reddish (image url changed) , next stars have gray color when cursor leaves stars state of 5 stars should before entering.

i wrote not , not working to:

var stars = { initstars: function initstars() { $('.starsholder').hover(function() { this.star1imageurl = $(this).children('.star').eq(0).attr('src'); this.star2imageurl = $(this).children('.star').eq(1).attr('src'); this.star3imageurl = $(this).children('.star').eq(2).attr('src'); this.star4imageurl = $(this).children('.star').eq(3).attr('src'); this.star5imageurl = $(this).children('.star').eq(4).attr('src'); $(this).children('.star').hover(function() { $(this).attr('src', '/star_red.png'); $(this).prevall('.star').attr('src', '/star_red.png');}, function() { }); }, function(){ $(this).children('.star').eq(0).attr('src', this.star1imageurl); $(this).children('.star').eq(1).attr('src', this.star2imageurl); $(this).children('.star').eq(2).attr('src', this.star3imageurl); $(this).children('.star').eq(3).attr('src', this.star4imageurl); $(this).children('.star').eq(4).attr('src', this.star5imageurl); $(this).children('.star').unbind(); }) } };

stars asp:imagebutton thats why alter src attribute doesnt matter. stars in span class starsholder

thanks help that

there many jquery plugins already. here few. take pick.

http://www.fyneworks.com/jquery/star-rating/

http://www.wbotelhos.com/raty/

http://orkans-tmp.22web.net/star_rating/

jquery

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -