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

  • Home
  • SEARCH
  • 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 6722999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:30:56+00:00 2026-05-26T09:30:56+00:00

I haven’t been able to load my page with a hidden map that I

  • 0

I haven’t been able to load my page with a hidden map that I can then Show clicking on :toggle_map_button

In my view a Show/Hide button and a map:

 <%= link_to_remote "Hide Map", :url =>{:action => :toggle_map}, :method => :get, :loading => visual_effect(:toggle_slide, "marketplace_map", :duration => 1, :queue => 'front'), :html => {:id => "toggle_map_button", :class => "toggle_map_button"} %>  

<%= gmaps(:map_options => {:detect_location => true, :center_on_user => true, :zoom => 6, :id => "marketplace_map" }, :markers => { "data" => @json }) %>       

In my CSS file:

#maketplace_map
{
   width: 100%;
   height: 400px;
   display: none; <= this doesn't get to be set (when I check in HTML code with Bugzilla)
}   

In my RJS file upon action :toggle_map:

page << "document.getElementById('toggle_map_button').innerHTML =(document.getElementById('toggle_map_button').innerHTML == 'Show Map' ? 'Hide Map' : 'Show Map')"

page.flash_msg(:notice_box, flash[:notice]) if flash[:notice]
page.flash_msg(:error_box, flash[:error]) if flash[:error]

flash.discard

The whole things works perfect when starting with a page showing the map. The toggle action does set display:none; correctly …

The issue is comes when starting with a hidden map and be able to click and slide it down.

Any ideas?

Cheers,

Joel

  • 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-05-26T09:30:57+00:00Added an answer on May 26, 2026 at 9:30 am

    Look bit closer at the html generated, I bet it’s looking like:

    <div class="map_container"> 
      <div id="marketplace_map" class="gmaps4rails_map"></div>
    </div>
    

    so the adequate CSS lever is the map_container class. Put display:none on it.


    since visual_effect seems to need an id, two options:

    • override the gmaps4rails partial

    • wrap the gmaps helper in a div: <div id="foo"> <%= gmaps(bar) %> </div>


    I’ve got another solution for you, just tested.

    You were right saying the map is small when hidden the visible.

    so add an option to your helper: <%= gmaps(whatever, :last_map => false)%>

    This will not create the map, only load it’s objects.

    Then add some javascript (I use jQuery but you’ve got the idea):

    <script>
    var createMap = true;
    $(function(){
      $("#click_me").click(function(){ 
      if (counter == true)
       {
        Gmaps.loadMaps(); //this will create the map
        counter = false;
       }
      $(".map_container").toggle();  // this hides and shows
      });
    });
    </script> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I haven't been able to find what these Xcode icons mean. Some you can
Haven't seen anything, but I have seen that you can create albums in the
I haven't been able to figure out how to use strings from resource files
I haven't been able to solve this prolog exercise. I was hoping someone here
I haven't been able to find authorative explanations, microformats or guidelines for the following,
I haven't really been able to find any good simple tutorials an animating a
Haven't been able to find this one out. How are Bitmaps stored in memory
I haven't been able to get this working and all of the sample code
I haven't seen a good RegEx using jQuery validate plugin that validates a phone
I haven't found a clear answer to this, so can someone help me? If

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.