05/23/2017 at 10:04 am
#423864
Keymaster
@ Mitch
Here’s the javascript for the Tile Plus template for the map. You’ll need to small mods it to work, but it is pretty much all that’s needed.
jQuery(document).ready(function ($) {
$('#cn-tile-plus .cn-category-select.cn-enhanced-select').chosen();
// Render map on single entry page
var cnSingleMap = $('#cn-gmap-single').length ? $('#cn-gmap-single') : false;
if ( cnSingleMap != false ) {
var fLatitude = 0;
var fLongitude = 0;
var uuid = cnSingleMap.attr('data-gmap-id');
var strAddress = $( '#map-' + uuid ).attr('data-address');
var strMapType = $( '#map-' + uuid ).attr('data-maptype');
var intZoom = parseInt( $( '#map-' + uuid ).attr('data-zoom') );
if ( $('#map-' + uuid ).attr('data-latitude') ) fLatitude = parseFloat( $( '#map-' + uuid ).attr('data-latitude' ) );
if ( $('#map-' + uuid ).attr('data-longitude') ) fLongitude = parseFloat( $( '#map-' + uuid ).attr('data-longitude') );
if ( fLatitude == 0 && fLatitude == 0 ) {
$( '#map-' + uuid ).goMap({
markers: [ { address: '\'' + strAddress + '\'' } ] ,
zoom: intZoom,
maptype: strMapType
});
} else {
$( '#map-' + uuid ).goMap({
markers: [ { latitude: fLatitude , longitude: fLongitude } ] ,
zoom: intZoom,
maptype: strMapType
});
}
}
});
