javascript - Semantic UI Ratings not displayed - Stack Overflow

I cannot make the ratings element displayed. It simply does not appear. All other things work fine enou

I cannot make the ratings element displayed. It simply does not appear. All other things work fine enough

I have linked these properly:

  • Semantic UI CSS (.min.css)
  • Semantic UI JS (.min.js)
  • JQuery (.1.4/jquery.min.js)

And I use it like this:

<div class="ui star rating" data-rating="4"></div>

Do I need to do something else to make it work?

I cannot make the ratings element displayed. It simply does not appear. All other things work fine enough

I have linked these properly:

  • Semantic UI CSS (http://semantic-ui./dist/semantic.min.css)
  • Semantic UI JS (http://semantic-ui./dist/semantic.min.js)
  • JQuery (https://ajax.googleapis./ajax/libs/jquery/2.1.4/jquery.min.js)

And I use it like this:

<div class="ui star rating" data-rating="4"></div>

Do I need to do something else to make it work?

Share Improve this question edited Dec 16, 2015 at 16:45 Fᴀʀʜᴀɴ Aɴᴀᴍ asked Dec 16, 2015 at 14:31 Fᴀʀʜᴀɴ AɴᴀᴍFᴀʀʜᴀɴ Aɴᴀᴍ 6,2515 gold badges33 silver badges53 bronze badges 11
  • Well the semantic links you provided do not load for me, could that be why? Or is that just me. – chriz Commented Dec 16, 2015 at 14:42
  • This works semantic-ui./dist/semantic.min.css – chriz Commented Dec 16, 2015 at 14:43
  • I posted https instead of http sorry. – Fᴀʀʜᴀɴ Aɴᴀᴍ Commented Dec 16, 2015 at 16:45
  • Are you calling the rating in your jQuery? $('.rating').rating(); ; – chriz Commented Dec 16, 2015 at 16:48
  • It is not even displaying. – Fᴀʀʜᴀɴ Aɴᴀᴍ Commented Dec 16, 2015 at 16:48
 |  Show 6 more ments

1 Answer 1

Reset to default 6

You need to initialize the rating plugin on the .rating div element in jQuery.

Either add this to your .js file:

// This waits for the DOM to load correctly before changing elements
$(document).ready(function(){
    // All your normal JS code goes in here
    $(".rating").rating();
});

Or if you don't have a .js file you can just include this Javascript/jQuery on each page the rating needs displayed.

<script type="text/javascript">$(document).ready(function(){$(".rating").rating();});</script>

And that will give you the same effect.

You can also specify different options within the initialization:

$('.rating')
  .rating({
    initialRating: 3,
    maxRating: 5
  })
;

You can find a list of options and other examples here: http://semantic-ui./modules/rating.html

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745663035a4638951.html

相关推荐

  • javascript - Semantic UI Ratings not displayed - Stack Overflow

    I cannot make the ratings element displayed. It simply does not appear. All other things work fine enou

    22天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信