大家好,我已经对此进行了相当长的一段时间的修改,但无法弄清楚。我有一个包含 3 个评级选项(质量、价值、服务)的评论页面。我正在使用 fyneworks jQuery Star Rating Plugin v4.11,并且喜欢显示无线电输入标题的悬停效果的想法(即差、好、好)。
我正在尝试完成以下任务:能够将鼠标悬停在每个评级选择上并在其旁边显示标题。选择(单击)评级后,我希望永久显示标题。Goole+ 使用了这种功能。
到目前为止,这是我的代码
jQuery
<script type='text/javascript'>
        $(document).ready(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>
html
<div>
    <p>Service Rating</p>
    <input class="hover-star" type="radio" name="test-3B-rating-1" value="1" title="Very poor"/>
    <input class="hover-star" type="radio" name="test-3B-rating-1" value="2" title="Poor"/>
    <input class="hover-star" type="radio" name="test-3B-rating-1" value="3" title="OK"/>
    <input class="hover-star" type="radio" name="test-3B-rating-1" value="4" title="Good"/>
    <input class="hover-star" type="radio" name="test-3B-rating-1" value="5" title="Very Good"/>
    <span id="hover-test" style="margin:0 0 0 20px;"></span>
</div>
<div>
    <p>Value Rating</p>    
    <input class="hover-star" type="radio" name="test-3B-rating-2" value="1" title="Very poor"/>
    <input class="hover-star" type="radio" name="test-3B-rating-2" value="2" title="Poor"/>
    <input class="hover-star" type="radio" name="test-3B-rating-2" value="3" title="OK"/>
    <input class="hover-star" type="radio" name="test-3B-rating-2" value="4" title="Good"/>
    <input class="hover-star" type="radio" name="test-3B-rating-2" value="5" title="Very Good"/>
    <span id="hover-test-2" style="margin:0 0 0 20px;"></span>
</div>
<div>
    <p>Quality Rating</p>    
    <input class="hover-star" type="radio" name="test-3B-rating-3" value="1" title="Very poor"/>
    <input class="hover-star" type="radio" name="test-3B-rating-3" value="2" title="Poor"/>
    <input class="hover-star" type="radio" name="test-3B-rating-3" value="3" title="OK"/>
    <input class="hover-star" type="radio" name="test-3B-rating-3" value="4" title="Good"/>
    <input class="hover-star" type="radio" name="test-3B-rating-3" value="5" title="Very Good"/>
    <span id="hover-test-3" style="margin:0 0 0 20px;"></span>
</div>
我被卡住了,不知道继续进行任何帮助将不胜感激。谢谢