2011-03-29 76 views
0

我玩星級插件,但我不能正確配置,顯示懸停標籤上的右側,這樣頁面上的測試-3B:jQuery的星級插件

http://www.fyneworks.com/jquery/star-rating/#tab-Testing

<script> 
$(function(){ 
$('.star').rating({ 
focus: function(value, link){ 
// 'this' is the hidden form element holding the current value 
// 'value' is the value selected 
// 'element' points to the link element that received the click. 
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> 
<input type="radio" name="rating" value="1" style="margin: 0;" class="star" title="Very  poor"/> 
    &nbsp; 
<input type="radio" name="rating" value="2" style="margin: 0;" class="star" title="Poor"/> 
    &nbsp; 
<input type="radio" name="rating" value="3" style="margin: 0;" class="star" title="OK"/> 
    &nbsp; 
<input type="radio" name="rating" value="4" style="margin: 0;" class="star" title="Good"/> 
    &nbsp; 
<input type="radio" name="rating" value="5" style="margin: 0;" class="star" title="Very good"/> 
<span id="hover-test" style="margin:0 0 0 20px;">Hover tips will appear in here</span><br /> 

回答

1

我試過你的插件,它效果很好。

我把源代碼在這裏:http://jsfiddle.net/VgWtG/

你可以自己測試一下。 對於您的代碼,請嘗試將<script type='text/javascript'>而不是</script>。然後,用div環繞您的​​一組輸入。

但我很確定你的問題來自一個缺少的包含(在我給你的源代碼中檢查它)。 此致敬禮。