Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 3 additions & 45 deletions experimental/gpaa-street-view.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,5 @@
/**
* Gravity Perks // GP Address Autocomplete // Add Google Street View
*
* Adds a Google Street View container to the bottom of the map and automatically
* updates the Street View when the user selects an address.
*
* Instructions:
* 1. Install our free Custom JavaScript for Gravity Forms plugin.
* Download the plugin here: https://gravitywiz.com/gravity-forms-code-chest/
* 2. Copy and paste the snippet into the editor of the Custom Javascript for Gravity Forms plugin.
* We're no longer using the experimental folder for experimental snippets. 🚧
* You can now find the snippet here:
* https://github.com/gravitywiz/snippet-library/blob/master/gp-address-autocomplete/gpaa-street-view.js
*/

window.gform.addAction('gpaa_marker_set', function (opts) {
var panorama = new google.maps.StreetViewPanorama(
document.getElementById('gpaa_street_view_container_' + opts.fieldId),
{
position: opts.map.getCenter(),
pov: {
heading: 34,
pitch: 10,
},
}
);

opts.map.setStreetView(panorama);
});



window.gform.addAction('gpaa_map_initialized', function(map, formId, fieldId) {
var mapSel = '#gpaa_map_container_' + fieldId;
var streetViewSel = '#gpaa_street_view_container_' + fieldId;

if (!$(streetViewSel).length) {
$(mapSel).after('<div id="gpaa_street_view_container_' + fieldId + '" >Select an address to see a street view.</div>');
var divHeight = '500px';
$(streetViewSel).css({
// customize styling properties for the street view container here...
height: divHeight,
lineHeight: divHeight,
backgroundColor: 'lightgray',
marginTop: '1rem',
textAlign: 'center',
verticalAlign: 'middle',
});
}
});
Loading