JqueryUI - Street View events


SUBMITTED BY: jlolk3r

DATE: Jan. 20, 2016, 6:20 a.m.

FORMAT: HTML

SIZE: 3.4 kB

HITS: 1276

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Street View events</title>
  6. <style>
  7. html, body {
  8. height: 100%;
  9. margin: 0;
  10. padding: 0;
  11. }
  12. #map {
  13. height: 100%;
  14. }
  15. #floating-panel {
  16. position: absolute;
  17. top: 10px;
  18. left: 25%;
  19. z-index: 5;
  20. background-color: #fff;
  21. padding: 5px;
  22. border: 1px solid #999;
  23. text-align: center;
  24. font-family: 'Roboto','sans-serif';
  25. line-height: 30px;
  26. padding-left: 10px;
  27. }
  28. #pano {
  29. width: 50%;
  30. height: 100%;
  31. float: left;
  32. }
  33. #floating-panel {
  34. width: 45%;
  35. height: 100%;
  36. float: right;
  37. text-align: left;
  38. overflow: auto;
  39. position: static;
  40. border: 0px solid #999;
  41. }
  42. </style>
  43. <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&signed_in=true"></script>
  44. </head>
  45. <body>
  46. <div id="pano"></div>
  47. <div id="floating-panel">
  48. <table>
  49. <tr>
  50. <td><b>Position</b></td><td id="position-cell">&nbsp;</td>
  51. </tr>
  52. <tr>
  53. <td><b>POV Heading</b></td><td id="heading-cell">270</td>
  54. </tr>
  55. <tr>
  56. <td><b>POV Pitch</b></td><td id="pitch-cell">0.0</td>
  57. </tr>
  58. <tr>
  59. <td><b>Pano ID</b></td><td id="pano-cell">&nbsp;</td>
  60. </tr>
  61. <table id="links_table"></table>
  62. </table>
  63. </div>
  64. <script>
  65. function initPano() {
  66. var panorama = new google.maps.StreetViewPanorama(
  67. document.getElementById('pano'), {
  68. position: {lat: 37.869, lng: -122.255},
  69. pov: {
  70. heading: 270,
  71. pitch: 0
  72. },
  73. visible: true
  74. });
  75. panorama.addListener('pano_changed', function() {
  76. var panoCell = document.getElementById('pano-cell');
  77. panoCell.innerHTML = panorama.getPano();
  78. });
  79. panorama.addListener('links_changed', function() {
  80. var linksTable = document.getElementById('links_table');
  81. while (linksTable.hasChildNodes()) {
  82. linksTable.removeChild(linksTable.lastChild);
  83. }
  84. var links = panorama.getLinks();
  85. for (var i in links) {
  86. var row = document.createElement('tr');
  87. linksTable.appendChild(row);
  88. var labelCell = document.createElement('td');
  89. labelCell.innerHTML = '<b>Link: ' + i + '</b>';
  90. var valueCell = document.createElement('td');
  91. valueCell.innerHTML = links[i].description;
  92. linksTable.appendChild(labelCell);
  93. linksTable.appendChild(valueCell);
  94. }
  95. });
  96. panorama.addListener('position_changed', function() {
  97. var positionCell = document.getElementById('position-cell');
  98. positionCell.firstChild.nodeValue = panorama.getPosition() + '';
  99. });
  100. panorama.addListener('pov_changed', function() {
  101. var headingCell = document.getElementById('heading-cell');
  102. var pitchCell = document.getElementById('pitch-cell');
  103. headingCell.firstChild.nodeValue = panorama.getPov().heading + '';
  104. pitchCell.firstChild.nodeValue = panorama.getPov().pitch + '';
  105. });
  106. }
  107. </script>
  108. <script
  109. src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&signed_in=true&callback=initPano"
  110. async defer>
  111. </script>
  112. </body>
  113. </html>

comments powered by Disqus