javascript - Set custom store marker on storeLocator.Store in Google -
i'm trying set custom marker each of stores. using google storelocator, there storelocator.store .setmarker option.
i tried lot
var store = new storelocator.store(store_id, position, storefeatureset, storeprops); var markerpin = new google.maps.marker( icon: 'http://url-to-marker.png' }); store.setmarker(markerpin);
i've been trying find on google there isn't out there on storelocator project.
i managed find out git repository of store locator project. in repository there sample examples , files demonstrates placement of markers. if dig examples directory , check out file places.js. can find code of how places populate markers. adding small code snippet, detailed overview can see whole project.
google.maps.event.adddomlistener(window, 'load', function() { var map = new google.maps.map(document.getelementbyid('map-canvas'), { center: new google.maps.latlng(-28, 135), zoom: 4, maptypeid: google.maps.maptypeid.roadmap }); var paneldiv = document.getelementbyid('panel'); var data = new placesdatasource(map); var view = new storelocator.view(map, data); var markersize = new google.maps.size(24, 24); view.createmarker = function(store) { return new google.maps.marker({ position: store.getlocation(), icon: new google.maps.markerimage(store.getdetails().icon, null, null, null, markersize) }); }; new storelocator.panel(paneldiv, { view: view }); });
Comments
Post a Comment