jQuery Vote Plugin

This plugin depends on the jQuery Corner Plugin. The styles are from the jQuery-ui themes. Dual licensed under the MIT and GPL licenses.

The following shows how to use the plugin.
$('#voter-1').voter();
<div id="voter-1"></div>

$('#voter-2').voter({start:5,max:7,min:4});
<div id="voter-2"></div>

$('#voter-3').voter({width:60,fontSize:30});
<div id="voter-3"></div>


$('#voter-4').voter({
  max:3,
  min:0,
  afterUp:function(val){$('#message').html("Thank you for voting up!");},
  afterDown:function(val){$('#message').html("But.. Why?");},
  maxReached:function(val){$('#message').html("You can't vote more than that..");},
  minReached:function(val){$('#message').html(val+" is the minimum.");}
});
<div id="voter-4"></div> 
<div id="message"/> 




Download available here.

3 comments:

  1. How to initialize it while in php loop for every comment?

    ReplyDelete
  2. Well, you can have a div with a specific class (say "comment-vote") and do $(".comment-vote").voter() in JavaScript. This will convert all divs with class "comment-vote" in to a vote widget. No need to use PHP then.

    ReplyDelete