twitter-bootstrap – Modal window when clicking on info box link opened by a Google Maps marker

Question:

I'm using Bootstrap and on my index page, I have some modal windows that open when I click on a href .

I also have a div for the map that reads a JSON file, where there is information to add the markers to it, they are: ID, latitude, longitude and a content for an "infobox" that will open when clicking on the marker.

The problem is that in this infobox content I have a:

<a href="#portfolioModal1" class="portfolio-link" data-toggle="modal">Veja mais</a>

Just like I do to open the modal window by other "a hrefs" on my page, however, this link above that is displayed in the bookmark infobox does not open the modal window. The URL changes to http://www.meusite.com/index.html#portfolioModal1

PS: It was as if the infobox was a synopsis and clicking on See more would open all the location information… but nothing happens. Any idea?

If you find it necessary to put code snippets, let me know that I do, I thought it wasn't necessary because those who know the tools mentioned know how they work.

Thanks!

Answer:

I got it here. Instead of using the bootstrap ready methods to open the modal via the infobox, in my infobox I did a <a href="#" onclick="mostrar()">Veja mais</a>

And then, in my index.html I made a js function mostrar()

        $('#portfolioModal' + id).modal('toggle');
        $('#portfolioModal' + id).modal('show');

It worked, my only problem is that the page goes up (goes to the top) it doesn't stay where it was…

Scroll to Top