Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7965863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:16:04+00:00 2026-06-04T06:16:04+00:00

Previously I followed the instructions in another answer to get the infowindow to automatically

  • 0

Previously I followed the instructions in another answer to get the infowindow to automatically open when there is just a single point on the map. I have this working but the infowindow is slightly cut off at the top since the map doesn’t recenter when opening up the infowindow manually (like it does when you click the marker to show the infowindow). My view just uses the basic:

gmaps(:map_options => { :auto_adjust => true },
      :markers => { :data => @json, :options => {:do_clustering => true} })

And the following JavaScript in my view:

<script type="text/javascript" charset="utf-8">
  Gmaps.map.callback = function() {
    if (Gmaps.map.markers.length == 1) {
      var marker = Gmaps.map.markers[0];
      var infowindow = marker.infowindow;
      infowindow.open(Gmaps.map.map, marker.serviceObject);
    }
  }
</script>

What I’m trying to figure out is the best way to both set the zoom level to 14 as well as well as recenter the marker so the entire infowindow shows onscreen and isn’t cut off at the top.

I’ve also looked at this question who seems to be having a similar issue but doesn’t include recentering. I too can execute Gmaps.map.map.setZoom(14); within console and have it execute as well as Gmaps.map.map.panBy(0, -80); but they don’t seem to execute from within the callback. Plus I’m not sure if panBy is the most effect way to address my infowindow being cut off problem.

Using: gmaps4rails (1.4.8) and Rails (3.2.3)

Anyone have any thoughts or ideas?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T06:16:05+00:00Added an answer on June 4, 2026 at 6:16 am

    As we finally conclude, you should use dedicated helper options when you have a single marker.

    Due to google maps async loading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have followed the instructions at http://www.javacodegeeks.com/2011/01/advanced-smartgwt-tutorial-part-1.html and tried to create a simple screen
Followed the instructions here and recreated certificates that I previously incorrectly created. Something has
We are open-sourcing a java software system that was previously proprietary. We loosely followed
See update below. This is driving me mad. I have followed all the instructions
I've followed the exact same steps which have always previously worked for me, create
Previously, I have worked on local notifications, but I got problem in it now.
Previously I have been investigating several solutions how to register with email address instead
Previously there the bing translator was easily accessible with the SOAP interface. Now it
Previously, I have an app that uses core data. I use same store url
I'm trying to submit my iOS app to the App Store, I have followed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.