Bootstrap 3 and Google Maps

Outdated: This post is preserved for reference and may no longer reflect current tools or services. For the most current example code, see the GitHub demo folder.

Bootstrap 3 introduced changes that could stop Google Maps from displaying correctly inside tabs or modals. This post shows how to update older Bootstrap 2 code to work with that change.

To use it in a tab, change the following:

$("#myModal").modal({ show: false }).on("shown", function(){

To:

$("#myModal").on("shown.bs.modal", function () {
//or shown.bs.tab for tabs

That’s it.

Check out the demo on GitHub for examples covering Bootstrap v2 through v5.

Resources