Guest User

Untitled

a guest
Dec 14th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. function addPolygon(points) {
  2. var polygon = new google.maps.Polygon({
  3. paths: points,
  4. strokeColor: " #FFFFFF",
  5. strokeOpacity: 0.15,
  6. strokeWeight: 1.5,
  7. fillColor: "#99ff66",
  8. fillOpacity: 0.14
  9. });
  10. var tooltip = document.createElement('div');
  11. tooltip.innerHTML = "Alok";
  12.  
  13. google.maps.event.addListener(polygon,'mouseover',function(){
  14. tooltip.style.visibility = 'visible';
  15. });
  16. google.maps.event.addListener(polygon,'mouseout',function(){
  17. tooltip.style.visibility = 'hidden';
  18. });
  19. polygon.setMap(map);
  20. }
  21.  
  22. //Add a listener for the click event
  23. google.maps.event.addListener('click', showArrays);
  24. infoWindow = new google.maps.InfoWindow;
  25.  
  26. function showArrays(event) {
  27.  
  28. var contentString = 'Content here';
  29.  
  30. // Replace the info window's content and position.
  31. infoWindow.setContent(contentString);
  32. infoWindow.setPosition(event.latLng);
  33.  
  34. infoWindow.open(map);
  35. }
  36.  
  37. map.data.addListener('mouseover', mouseOverDataItem);
  38. map.data.addListener('mouseout', mouseOutOfDataItem));
  39.  
  40. function mouseOverDataItem(mouseEvent) {
  41. const titleText = mouseEvent.feature.getProperty('propContainingTooltipText');
  42.  
  43. if (infoText) {
  44. map.getDiv().setAttribute('title', infoText);
  45. }
  46. }
  47.  
  48. function mouseOutOfDataItem(mouseEvent) {
  49. map.getDiv().removeAttribute('title');
  50. }
Add Comment
Please, Sign In to add comment