Answer the question
In order to leave comments, you need to log in
How to call a Javascript event for the Share widget from Yandex?
Widget from Yandex "Share" buttons: https://tech.yandex.ru/share/
It has an API: https://tech.yandex.ru/share/doc/dg/api-docpage/
.. which reports about onshare and onready events
I'm a bit stupid in javascript.. please tell me where and how to register the "onshare" event so that when it is done, it gives out alert("OK") ??
<div onshare="alert("Ок");" class="ya-share2" data-services="vkontakte,twitter,facebook,gplus" data-counter></div>
Answer the question
In order to leave comments, you need to log in
Everything works fine even with a simple ctrl-c+ctrl-v
Copied from the official documentation
Essentially:
<div id="ya_share" class="ya-share2" data-services="vkontakte,twitter,facebook,gplus" data-counter></div>
Ya.share2('#ya_share', {
hooks: {
onready: function () {
alert('блок инициализирован');
},
onshare: function (name) {
alert('нажата кнопка' + name);
}
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question