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.
How to initialize it while in php loop for every comment?
ReplyDeleteWell, 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.
ReplyDeleteYep it sorted out thanks man...
ReplyDelete