Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

264
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);

    }
about 4 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 Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!