Code Monkey home page Code Monkey logo

mobilegmap's Introduction

jQuery responsive google maps

What's it all about?

Well, when scrolling a website on your mobile device you can get trapped in a google map due to the Maps scrollbar of death™. This plugin gives you a native google maps on your website and a safe fallback to the static image API of google maps for smaller devices.

More info can be found here: http://joggink.com/2012/01/responsive-google-maps/

How to use?

Download the jquery.mobilegmap.js. Removing comments and minifying it will get you bonus points!

To use it:

$(document).ready(function(){

  // your google map container
  $('.gmap').mobileGmap();

})

You can optionally change these default parameters:

$(document).ready(function(){

  // your google map container
  $('.gmap').mobileGmap({
    deviceWidth: 480, // The select will be added for screensizes smaller than this
  });

})

If you want to pass the address, zoom level and the maptype you can use HTML5 data-attributes

  <div class="gmap" id="map" data-center="Brugse Heirweg 37 Aartrijke Belgium" data-zoom="15">
    <address>
      <strong>builtbyrobot</strong><br />
      Brugse Heirweg 37<br />
      8211 Aartrijke
    </address>
  </div>

And that's it that's all.

However...

There are still some things that need to be taken care of:

  • make it optional to show / hide the address marker
  • add multiple markers with balloons containing more info / fallback with numbers or letters for the mobile version

mobilegmap's People

Contributors

joggink avatar

Watchers

James Cloos avatar Francisco Calderón Jurado avatar

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.