【问题标题】:star rating in bootstrap popover引导弹出窗口中的星级
【发布时间】:2014-04-04 21:46:22
【问题描述】:

有没有办法在引导弹出窗口中添加星级?

我试过这样做但我没有得到计数 -

代码 -

$('#member1').popover({
    html: true,
    placement: 'bottom',
    content: function() {
        return $($(this).data('contentwrapper')).html();
    }
}).click(function() {
    $('.star').each(function(el) {
      $(this).raty('destroy');
        $(this).raty({

            starOff : 'http://wbotelhos.com/raty/lib/images/star-off.png',
            starOn : 'http://wbotelhos.com/raty/lib/images/star-on.png',
            start: $(this).attr('data-rating')
        });

    });
});

http://jsfiddle.net/x9WhH/3/

有没有更好的解决方案?

我想要这样的结果 -

【问题讨论】:

    标签: jquery css twitter-bootstrap twitter-bootstrap-3


    【解决方案1】:

    我无法将您的示例图像与小提琴相关联?但是,认为 row / col 标记以某种方式破坏了弹出框,为什么不只是

    <div class="contentEval">
       <div class="ratings star" id="rating1" data-rating="1"></div>
    </div>
    

    然后,请参阅评分文档 -> http://wbotelhos.com/raty/ 您需要创建一个事件,您可以在其中将选定的评分转移回 data-range 属性:

    ..
    click: function(score, evt) {
      $('#member1').popover('hide');                   
      $(this).attr('data-rating', score);
      alert('your rating is : '+$('.star').attr('data-rating'));
    }
    ..
    

    见分叉小提琴 -> http://jsfiddle.net/4C5W6/

    【讨论】:

      猜你喜欢
      • 2021-03-07
      • 1970-01-01
      • 1970-01-01
      • 2018-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-05
      相关资源
      最近更新 更多