Skip to content Skip to sidebar Skip to footer

Jquery Location Picker Plugin Get Zoom

How can I get zoom property in jQuery Location Picker Plugin? I can get map coordinates using currentLocation.latitude and currentLocation.longitude, but does any body know how to

Solution 1:

since the plugin does not support that map-event, you'd have to bind it by yourself ...

google.maps.event.addDomListener(window, 'load', function() {

  $('#map_canvas').locationpicker({
      location: {latitude: 40.7324319, longitude: -73.82480777777776},
      radius: 300
  });

  /* bind the zoom_changed event for the plugin's map handle */
  $('#map_canvas').data('locationpicker').map.addListener('zoom_changed', function() {
    var map = $('#map_canvas').data('locationpicker').map;
    console.log('zoom level: ' + map.getZoom());
  });

});
html, body, #map_canvas {height: 100%; width: 100%; margin: 0px; padding: 0px;}
<scriptsrc="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><scriptsrc="//maps.googleapis.com/maps/api/js"></script><scriptsrc="//rawgit.com/Logicify/jquery-locationpicker-plugin/master/dist/locationpicker.jquery.js"></script><divid="map_canvas"></div>

Post a Comment for "Jquery Location Picker Plugin Get Zoom"