I have a site I helped a friend put together that has real estate listings. It’s WordPress based and we’re using the DS-IDX plugin to display listings. The nice thing is that they provide a simple URL to generate listings for a given area. However, we wanted the map to remain hidden when the results are first loaded. It’s a bit “hacky” but here’s how you can get it done.
Here’s what you need:
$( document ).ready(function()
That’s the trick. We check to see if the map is visible or not (for those refresh cases that it already starts out hidden) and if it is visible, we set a timeout for one second that triggers the click event if you were to manually click the link to hide the map.
Why the delay? Well, the IDX plugin loads the data first and then makes a call to render the Google Map. If I hide the map immediately, something odd happens and the map isn’t rendered properly. It could be related to parsed map points, it could be something else. I’m not 100% sure. That said, when the page loads, the animation if hiding isn’t that visible (if at all) and you could potentially slide this down to half a second.
Next time you load the page, it’ll look like this:
…and that’s it! Hope this helps! Enjoy!