How to zoom in the map when clicking on the POI?

  1. Home
  2. Docs
  3. Conference Pro
  4. Frequently Asked Question...
  5. How to zoom in the map when clicking on the POI?

How to zoom in the map when clicking on the POI?

Please activate child theme before applying the below changes.

1) Login to the dashboard. Navigate appearance -> editor menu. Select functions.php from the right side of the page.

Add the following code after <?php line

add_action(‘wp_print_scripts’, ‘conferenepro_child_custom_js’);
function conferenepro_child_custom_js(){
wp_dequeue_script(‘cpt-jquery-map’);
wp_enqueue_script( ‘cpt-jquery-child-map’, get_stylesheet_directory_uri() . ‘/assets/js/jquery.map.js’, array( ‘jquery’ ), false, false );
}

2) Update the file.

3) Copy wp-content/themes/conferencepro/assets/js/jquery.map.js to child theme wp-content/themes/conference-pro-child/assets/js/jquery.map.js
(Create the folder structure in child theme)

4) Open wp-content/themes/conference-pro-child/assets/js/jquery.map.js

5) Around line number 38, you can find:

_checkPlacemerk = function (id) {
var place = _findPlacemark(id);
if (place !== false) {
if (_window.width() >= 767) {
_map.panTo({
lat: place.getPosition().lat(),
lng: place.getPosition().lng() – delta / markerZoom
});
} else {
_map.panTo({
lat: place.getPosition().lat() – deltaY / markerZoom,
lng: place.getPosition().lng()
});
}
_map.setZoom(markerZoom);
place.info.open(_map, place);
}
}

6) Replace this with:

_checkPlacemerk = function (id) {
var place = _findPlacemark(id);
if (place !== false) {
if (_window.width() >= 767) {
_map.panTo({
lat: place.getPosition().lat(),
lng: place.getPosition().lng() – delta / markerZoom
});
_map.setZoom( 18 );
} else {
_map.panTo({
lat: place.getPosition().lat() – deltaY / markerZoom,
lng: place.getPosition().lng()
});
_map.setZoom(markerZoom);
}

place.info.open(_map, place);
}
}

7) You can adjust zoom value in _map.setZoom function. We have set 18 for desktops now

8) This is a hint. You can adjust zoom value as per your requirement.

Was this article helpful to you? Yes No