E
E
Edward2021-09-15 23:39:35
JavaScript
Edward, 2021-09-15 23:39:35

Two comment widgets per page, is there such a thing?

Good evening. Is there a commenting system that allows you to place two or more comment widgets on one page at the same time? I need to be able to show/hide them under certain conditions. I tried hypercomment, when adding a second widget it just doesn't show (well, it's understandable, they have the same id ).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daskus, 2021-09-16
@Daskus

You can try using the Vkontakte comments widget.
https://vk.com/dev/Comments
To add two or more widgets, create them.
You need to connect the library 1 time.

<script type="text/javascript" src="https://vk.com/js/api/openapi.js?169"></script>

Initialize the widget itself as many times as there are widgets.
<script type="text/javascript">
  VK.init({apiId: 5023113, onlyWidgets: true});
</script>
<!-- Put this div tag to the place, where the Comments block will be -->
<div id="vk_comments"></div>
<script type="text/javascript">
   VK.Widgets.Comments("vk_comments", {limit: 10, attach: "*"});
</script>

Just use different IDs for containers.
vk_comments in the example. For the second, for example vk_comments_2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question