F
F
Franked2018-10-30 08:59:58
JavaScript
Franked, 2018-10-30 08:59:58

How to navigate by clicking on the Yandex map of the native 1C Bitrix component?

Hello!
Please tell me how to implement this:
There are a number of links for chains of stores, the locations of which are already placed in the standard Yandex.Maps custom component (for 1C-Bitrix), and by clicking on the link my map would change the location to the store whose link I clicked .
I've been looking for an answer to my question for an hour now, I'm trying to figure out how to do this, but so far everything is in vain ...
Please help me figure it out!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2018-10-30
@Franked

The output of the map goes with the help of 2 components:
The first calls the second.
script.js of the map.yandex.system template has the following code:

//.......
var map = window.GLOBAL_arMapObjects['<?echo $arParams['MAP_ID']?>'] = new ymaps.Map();
//.......

The ymaps.Map object has a setCenter method that sets the map's center and zoom factor. The center is specified in geographic coordinates.
$arParams['MAP_ID'] is set in the component settings. Let's say it is equal to "test"
Then it will be possible to do this:
All that remains is to write a click handler for your links that will take the coordinates of the point and call setCenter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question