How to use personalized icon with jquery-ui-map -
using jquery-ui-map, try use personnalized icon. works fine way :
$("#gmap_" + parent).gmap('addmarker', { "id": "marker-"+m.id, 'position': new google.maps.latlng(m.lat, m.lon), 'bounds':true, 'icon': '/images/'+m.icon }) as icon url. want put icons in sprite, have set other option :
$("#gmap_" + parent).gmap('addmarker', { "id": "marker-"+m.id, 'position': new google.maps.latlng(m.lat, m.lon), 'bounds':true, 'icon': new google.maps.markerimage( { 'url' : "http://crm.brunet.pro/images/markers.png", 'origin': new google.maps.point(m.pos, 0), 'size' : new google.maps.size(20, 34) }) }) i error :
get http://mysite.com/[object%20object] 400 (bad request) so looks icon option accepts string. can see in api should accept markerimage object.
what did wrong ?
thanks
markerimage created 5 arguments, like, markerimage(myurl, size1, point1, point2), have written 1 object argument.
i think api doc can confusing in cases this. check out these examples:
https://developers.google.com/maps/documentation/javascript/overlays#complexicons
var image = new google.maps.markerimage('images/beachflag.png', // marker 20 pixels wide 32 pixels tall. new google.maps.size(20, 32), // origin image 0,0. new google.maps.point(0,0), // anchor image base of flagpole @ 0,32. new google.maps.point(0, 32)); http://blog.mridey.com/2010/03/using-markerimage-in-maps-javascript.html (explains loading sprite sheet)
size, origin, anchor not mentioned, need respect order given in api docs.
Comments
Post a Comment