我在Rails 3.1.3应用程序中使用gmaps4rails并且我已经在gmaps4rails.base.js.coffee文件中设置了位置检测,就像这样;
@default_map_options =
id: 'map'
draggable: true
detect_location: true # should the browser attempt to use geolocation detection features of HTML5?
center_on_user: true # centers map on the location detected through the browser
center_latitude: 0
center_longitude: 0
zoom: 7
maxZoom: null
minZoom: 10
auto_adjust : true # adjust the map to the markers if set to true
auto_zoom: true # zoom given by auto-adjust
bounds: [] # adjust map to these limits. Should be [{"lat": , "lng": }]
raw: {} # raw json to pass additional options
这有一半的时间。我注意到当我点击F5或Ctrl + r来刷新浏览器时,它有时会让我进入布罗肯希尔,当时我应该在墨尔本(840公里的差异)。
有时我会很快看到Broken Hill,然后在装载时切换到墨尔本。以下是我安装的所有其他插件:
#= require gmaps4rails/gmaps4rails.base
#= require gmaps4rails/gmaps4rails.googlemaps
#= require jquery
#= require jquery_ujs
#= require jquery.ui.datepicker
#= require jquery-ui-timepicker-addon
#= require jquery.ui.autocomplete
#= require jquery.ui.slider
#= require jquery.flexslider
#= require jquery.ui.widget
#= require jquery.ui.mouse
#= require jquery.ui.touch-punch.min
#= require jQuery.BlackAndWhite
#= require form-accordion
#= require modernizr
#= require lovesjavascript
#= require jquery.tokeninput
#= require authentications
#= require inquiries
#= require registrations
#= require search
#= require tinymce-jquery
#= require jquery.sticky
#= require_self
我尝试过只使用gmaps4rails base&谷歌地图仍然存在问题。