How to open a Google Map inside a Bootstrap modal

I'm trying to open a Google Map inside a Bootstrap modal. The modal works great, but only an empty container appears where the map should be displayed. It's like the Google script isn't run at all.  I must be missing some crucial step, but I've worked on this and I still don't see why it doesn't work.

I have set up a stripped down jsFiddle at https://jsfiddle.net/midnightCabbie/fkq56v51/

Please take a look and share your thoughts
dlearman1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
This is usually caused by the fact that Google Maps does not render in a container that is not visible. You have to trigger a resize on the map after opening the dialog - which your fiddle attempts to do but you are undone by some typos

1. Line 82 your closing brackets are )}; instead of });
2. Your selector for the show.bs.modal is mapWrapper which is the map container rather than mapModal which is the id of the modal window
3. Your marker refers to icon and shadow variables that are not defined.

So basically your show.bs.modal event handler was never firing and the resize trigger never happened therefore no map.

Here is a sample using your code

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dlearman1Author Commented:
Julian thanks for your comments and solution.

I'd be embarrassed to tell you how long I've stared at that code and never picked up a clue. Your answer works perfect.

Thank you.
Julian HansenCommented:
You are welcome - and it is the nature of coding to miss what is right in front of you - sometimes you just need a second pair of eyes. Good luck with your project.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.