Answer the question
In order to leave comments, you need to log in
Compatibility of API methods of the "Share" block from Yandex with jQuery objects, is it available?
Hello!
Now I'm learning to make a website on PHP+Yii Framework. In the client side, I use not only HTML5 and CSS3, but also JS + JQuery.
Have you heard of the "Share" button for websites? I have known about this for a long time. For several years, Yandex has been developing its technology for third-party web developers - the "Share" block with its JavaScript API. I wanted to try it for future promotion (I'm currently working on the local host).
I wanted to use the API, but the single script of my site is written in the same JQuery and I used JQuery methods and objects in the API call code, and this is my written example (I haven’t tested it yet):
var siteshare=$('.dobriye-vzroslye-site-ya-share');//Открываю доступ к элементу для социальных иконок с помощью объекта JQuery
var ssh=Ya.share2(siteshare,{
theme: {
services: 'facebook,twitter,vkontakte,odnoklassniki,gplus,tumblr,viber,whatsapp',
counter: true,
lang: 'ru',
size: 'm',
bare: false,
direction: 'horizontal'
},
content: {
url: $("site-social-all-data > #url").val(),
title: $("site-social-all-data > #title").val(),
description: $("site-social-all-data > #description").val(),
image: $("site-social-all-data > #imagesrc").val()
}
});
ssh.updateContentByService({
facebook:{
url: $("site-social-all-data > #url").val(),
title: $("site-social-all-data > #title").val(),
description: $("site-social-all-data > #description").val(),
image: $("site-social-all-data > #imagesrc").val(),
accessToken: 'EAADIvyUDV1MBAMEjXhru312PZCMQGXDtmwqxL1GfMa9y4EJvSZAO0ZAUUdIwEs91bypuBAWZAUYHB5s4R1lu8rYZBAxo0lZB18bouSgs6qV4KoegvvVonzorbbsMG3R69rA9bV3vibOsJYRSAMOWEULZBVaxTqe5thhhaU6ZA511H9lKcwZBzmrCA7LZAPFxhWXZAQZD'
}
});
Answer the question
In order to leave comments, you need to log in
Also, instead of an id, you can pass the element itselfi.e. if you want to use jQuery, then you need to pass it like this:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question