Get current position in Google Maps JavaScript API v3 and get the dot to follow me without user interaction

青春壹個敷衍的年華 提交于 2019-12-09 07:51:53

问题


I am assuming this is not possible or advisable due to the nature of the web but I will ask anyway.

I know I can get a user's current location and centre on a map using the Google Maps JavaScript API v3. I can even get it to show a dot for where the user is currently located.

What I really want to know, and my client is asking for this, is can I get the dot to follow the user around without user interaction (ie.. the user does not interact with the device, the dot just moves when the user moves.)? All I can think of is that I would need to add a timer event to continuously check the current location and update the dot. I don't feel this would be best practice.

I have found lots of posts on how to do this in an android or IOS device but not on the web.

Any pointers and info will be greatly appreciated.

thanks Russ


回答1:


This is exactly what you need 1

The working example is here: 2

Good Luck :) UPDATED: The Links are now pointing to the new location on git hub



来源:https://stackoverflow.com/questions/26748204/get-current-position-in-google-maps-javascript-api-v3-and-get-the-dot-to-follow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!