Coder Social home page Coder Social logo

jquery.mapfu's Introduction

jQUery mapfu plugin

Description

jQuery mapfu is a simple plugin to allow easy Google Map creation using version 3 of the JavaScript API. This means that an API key is not needed, but it also means that only features supported in V3 of the API are available to the plugin. Google is continually updating and adding new features to the API. I will continue to add more until the plugin supports all features in the V3 API and hopefully keep up with Google as they make changes.

NOTE: Development has been halted for now. Please check out one of these plugins as a replacement for now: https://github.com/fridek/gmap https://github.com/jbdemonte/gmap3

Usage

First, include jQuery, the Google Map JavaScript API, and this plugin:

<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false'></script> <script type='text/javascript' src='jquery.js'></script> <script type='text/javascript' src='jquery.mapfu.js'></script>

Next, include a div that will hold the map:

<div id='map'></div>

Now just call the mapfu function on a DOM element. It is usually best to do this once the document is ready.

$("#map").mapfu();

Since this just creates an empty map of the US, options must be passed to add desired functionality.

Examples

Download the project, then open examples.html in your browser to see a few examples.

Options

The following options are available when calling the plugin. Defaults are shown in parentheses.

data ([])

The objects that will be passed to create the markers and infowindows. As long as valid JSON is passed to this option, it doesn't care how it comes in. It could be manually written out, pulled from a back-end, or pulled in via getJSON and then passing it to the plugin. The only requirements are (1) include a root element that bundles all of the sub-elements in and (2) objects respond to "lat" and "lng" for the latitude and longitude values, respectively. I'm hoping to add a feature so this isn't a requirement and there are options to set these.

latitude (null)

The central latitude point for the map.

longitude (null)

The central longitude point for the map.

title (function() {})

Function used to pass a string to the marker that is displayed on hover.

html (function() {})

Function used to pass a string of HTML to an infowindow that is opened when the marker is clicked.

zoom (8)

Set the zoom level of the map using an integer.

mapType ("roadmap")

Sets the type of map to display. Available options are "roadmap", "satellite", "hybrid", "terrain".

scrollwheel (true)

If false, disables scrollwheel zooming on the map.

navigationControl (true)

If false, the pan/zoom control is hidden.

mapTypeControl (true)

If false, the control to change map types is hidden.

scaleControl (false)

If true, shows the map scale control.

icon

A hash containing options for marker icons. See below for actual options.

icon.image ('http://www.google.com/mapfiles/marker.png')

Reference to an image that is used for your markers.

directions (false)

Instead of showing distinct markers, use the data objects to show waypoints in a route.

directionsResult (null)

A callback function which, if specified, will receive the result of the directions request, status, and an instance of DirectionsRenderer for rendering the route onto the map. If provided, the route will not be drawn automatically. It is expected that your callback function will at some point call setDirections(result) on the DirectionsRenderer instance.

Notes

Google Maps API V3

License

jQuery mapfu is under by the MIT License. See LICENSE for more information.

jquery.mapfu's People

Contributors

devjj avatar geetarista avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

devjj

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.