Answer the question
In order to leave comments, you need to log in
How to add multiple market.yandex widgets to one page?
Greetings. The documentation has an example:
<script async src="https://aflt.market.yandex.ru/widget/script/api" type="text/javascript"></script>
<script type="text/javascript">
(function (w) {
function start() {
var widgetParams = [
{
containerId: "marketWidget1",
... // Свойства первого виджета
},
{
containerId: "marketWidget2",
... // Свойства второго виджета
},
...
];
w.removeEventListener("YaMarketAffiliateLoad", start);
for (var i = 0; i < widgetParams.length; i++) {
w.YaMarketAffiliate.createWidget(widgetParams[i]);
}
w.YaMarketAffiliate
? start()
: w.addEventListener("YaMarketAffiliateLoad", start);
})(window);
</script>
<div id="marketWidget1"></div>
...
<div id="marketWidget2"></div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question