• Hi – This plugin seems great, and works really well, except:

    I need to display the search bar only on page load and then let the maps appear only with the listings

    Is this possible?

    Vik

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi there,

    The plugin does not offer that functionality out of the box, you will have to do some CSS hacks to get that effect, but unfortunately we have never tried that ourselves, sorry about that!

    Thread Starter harmlessvikmartin

    (@harmlessvikmartin)

    Thanks for replying. I thought of using CSS to hide it but I can’t find any way to target the map on page load but not once the search is complete.

    any ideas?

    Hi again,

    Unfortunately I can’t come up with any ideas for what you want to do, since the classes and the markup is the same regardless of the map being on page load or in a subsequent search, sorry about that!

    Thread Starter harmlessvikmartin

    (@harmlessvikmartin)

    Thanks for trying Farroyo

    For anyone stumbling across this in the future… I hid the map with display:none; initially and then added a class to it on button click using Javascript…

    // Get references to the DOM elements
    const gmapElement = document.getElementById("wpsl-gmap");
    const searchBtnElement = document.getElementById("wpsl-search-btn");
    
    // Add a click event listener to the search button
    searchBtnElement.addEventListener("click", function() {
      // Add the "active" class to the gmap element
      gmapElement.classList.add("active");
    });

    Then set the active class to display:block;

    Hi again,

    Many thanks for that solution, it’s clever! I hope it helps other users.

    Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to hide map until a search is made’ is closed to new replies.