treehouse : what would you like to learn today?
Web Design Web Development iOS Development

jquery and google maps

  • I'm trying to incorporate a custom google map into my wordpress website and google gives me javascript embedded into the html.
    The function itself I can dump into my functions.js but does anyone know how I can avoid using this:

    <body onload=\"load()\" onunload=\"GUnload()\">


    And do the same via jquery?

    Here is my onload attempt:

    $(document).ready(function(load){
    // Your code here
    });


    Not sure about onunload though. Would I use the unload function http://docs.jquery.com/Events/unload#fn ? I'm not sure how to write it though and to check that it does execute the GUnload function on unload.

    Any help would be much appreciated.
  • Try using this jQuery plugin http://plugins.jquery.com/project/jmaps it should take care of the google maps for you.
  • Well, I'll be damned.

    Thanks, that's a little easier.