• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

206
Views
Google maps API : marker position and shift map

I was using Leaflet so far, now I'm using Google Map (100% width of the screen).

I have a marker that was positionned in the center of the map. How can I shift the map so that the marker is shown at 75% of the screen ?

Basicaly, I want to switch from this display

    <---screen width-->
    ___________________
    |                 |
    |        x        |
    |_________________|
    

To that

    <---screen width-->
    ___________________
    |                 |
    |              x  |
    |_________________|

This is how I place my marker now :

    function updateMarkerPosition(marker) {
      const lat = marker.getPosition().lat();
      const long = marker.getPosition().lng();
      const newLatlng = new google.maps.LatLng(lat, long);
      marker.setPosition(newLatlng);
      map.setCenter(newLatlng); //will logicaly be deleted ?
      map.panTo(newLatlng) //no sure about this
      map.setZoom(15);
      //placing with leaflet
      const offset = e.popup._container.clientWidth - e.popup._container.clientWidth / (window.innerWidth >= 767 ? window.innerWidth : 1);

    }
almost 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error