我正在使用此jQuery Star Rating plugin
它正在运行,但是我点击后点击鼠标时我仍然试图将鼠标悬停在页面上。目前,在点击并移开鼠标后,它会消失。
<script>
$(function(){
$('.hover-star').rating({
focus: function(value, link){
var tip = $('#hover-test');
tip[0].data = tip[0].data || tip.html();
tip.html(link.title || 'value: '+value);
},
blur: function(value, link){
var tip = $('#hover-test');
$('#hover-test').html(tip[0].data || '');
}
});
</script>
<form id="ratingform">
<table width="100%" cellspacing="10">
<tr><Td>Hover over the stars and then click</td></tr>
<tr>
<td valign="top" width="">
<div class="Clear">
<div>
<input class="hover-star" type="radio" name="rating" value="1" title="Very poor"/>
<input class="hover-star" type="radio" name="rating" value="2" title="Poor"/>
<input class="hover-star" type="radio" name="rating" value="3" title="OK"/>
<input class="hover-star" type="radio" name="rating" value="4" title="Good"/>
<input class="hover-star" type="radio" name="rating" value="5" title="Very Good"/>
<span id="hover-test" style="margin:0 0 0 20px;"></span>
</td>
</tr>
</table>
答案 0 :(得分:0)
您可以使用“回调”功能并使用与“焦点”功能相同的代码。点击星号时执行“回调”功能:
$(function(){
$('.hover-star').rating({
focus: function(value, link){
..
},
blur: function(value, link){
..
},
callback: function(value, link){
var tip = $('#hover-test');
tip[0].data = tip[0].data || tip.html();
tip.html(link.title || 'value: '+value);
}
});