|
1 | 1 | /** |
2 | | - * Gravity Perks // GP Address Autocomplete // Add Google Street View |
3 | | - * |
4 | | - * Adds a Google Street View container to the bottom of the map and automatically |
5 | | - * updates the Street View when the user selects an address. |
6 | | - * |
7 | | - * Instructions: |
8 | | - * 1. Install our free Custom JavaScript for Gravity Forms plugin. |
9 | | - * Download the plugin here: https://gravitywiz.com/gravity-forms-code-chest/ |
10 | | - * 2. Copy and paste the snippet into the editor of the Custom Javascript for Gravity Forms plugin. |
| 2 | + * We're no longer using the experimental folder for experimental snippets. 🚧 |
| 3 | + * You can now find the snippet here: |
| 4 | + * https://github.com/gravitywiz/snippet-library/blob/master/gp-address-autocomplete/gpaa-street-view.js |
11 | 5 | */ |
12 | | - |
13 | | -window.gform.addAction('gpaa_marker_set', function (opts) { |
14 | | - var panorama = new google.maps.StreetViewPanorama( |
15 | | - document.getElementById('gpaa_street_view_container_' + opts.fieldId), |
16 | | - { |
17 | | - position: opts.map.getCenter(), |
18 | | - pov: { |
19 | | - heading: 34, |
20 | | - pitch: 10, |
21 | | - }, |
22 | | - } |
23 | | - ); |
24 | | - |
25 | | - opts.map.setStreetView(panorama); |
26 | | -}); |
27 | | - |
28 | | - |
29 | | - |
30 | | -window.gform.addAction('gpaa_map_initialized', function(map, formId, fieldId) { |
31 | | - var mapSel = '#gpaa_map_container_' + fieldId; |
32 | | - var streetViewSel = '#gpaa_street_view_container_' + fieldId; |
33 | | - |
34 | | - if (!$(streetViewSel).length) { |
35 | | - $(mapSel).after('<div id="gpaa_street_view_container_' + fieldId + '" >Select an address to see a street view.</div>'); |
36 | | - var divHeight = '500px'; |
37 | | - $(streetViewSel).css({ |
38 | | - // customize styling properties for the street view container here... |
39 | | - height: divHeight, |
40 | | - lineHeight: divHeight, |
41 | | - backgroundColor: 'lightgray', |
42 | | - marginTop: '1rem', |
43 | | - textAlign: 'center', |
44 | | - verticalAlign: 'middle', |
45 | | - }); |
46 | | - } |
47 | | -}); |
0 commit comments