Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Gareth Redfern
Gareth Redfern
36,217 Points

iFrames & Customizing Google Maps

I have just finished the last jQuery/Javascript lesson ;-) Really enjoyed this one and found the tasks much easier to follow than the integration (step 4) I especially liked the fault finding when the map wasn't quite working right as this is something which gets me a lot, sometimes it's actually hard to understand the console error messages.

Question One

We use an iframe to keep the design responsive but why was this approach taken? I have always stayed away from iframes (I read once, probably incorrectly) that they were bad for accessibility. I have had a quick look up on the mdn website for the definition for anyone else that may be interested in them.

Question Two

I know this would probably have been too advanced for this course (walk before you can run) but could we have used ajax to somehow load the map into an empty div?

Thanks again for a great course.

Gareth

5 Answers

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

Hi Gareth,

Answer One That was the quickest way to resolve the issue without reverse engineering Google's styling and seeing how to override or add to with out own somehow. It may have been way beyond the scope of this course.

Sometimes we have to do things which we wouldn't normally do to 1) Get them out of the door and/or 2) That could be the only solution to the issue.

I think it's good to have ideals to guide you but not be too dogmatic that you end up losing time chasing an unobtainable ideal.

Answer Two Google Maps is doing something very similar to what you'd do with AJAX. It injects styles and elements in to the page itself. That's why our styling overrides Google's. By having it in an iframe with we isolate Google's styling from our's.

In short, it was the most simple and easy to follow way of resolving this issue :)

Regards

Andrew

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

Also I see more and more embeds being iframes too nowadays.

Gareth Redfern
Gareth Redfern
36,217 Points

Great stuff and thanks again for all your help along the way. Last question, for a while anyway :-) what's next on the jquery/javascript front from Treehouse? I am super excited about things to come.

Gareth

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

I'm working on some more courseware for our Foundations curriculum unrelated to JavaScript which we're not ready to announce yet but I've got a Workshop in February which you've given me some ideas on. So keep your eyes peeled!

Gareth Redfern
Gareth Redfern
36,217 Points

Great stuff looking forward to it ;-)