Page 1 of 1

gmap title not showing in app but shows in desktop

Posted: Fri Dec 14, 2018 4:32 am
by Vinny B

Hello

My below code shows the marker in the map BUT DOES NOT show the title.

var map = Appery("googlemap_3").gmap;

// B1481 - 10th Ave & 50th St
var sfLatlng = new google.maps.LatLng(40.63847,-73.99933);
var marker = new google.maps.Marker({
position: sfLatlng,
map: map,
title: "B1481 - 10th Ave & 50th St",
icon: "../img/Fire_Marker_Red.png"
});

If I open the app in a browser and place the mouse of the marker the title will appear

Image

But in he app if i push on the marker with my finger the title DOES NOT Appear.

Any Ideas on how to get the title to appear in APP?


gmap title not showing in app but shows in desktop

Posted: Fri Dec 14, 2018 5:01 pm
by Serhii Kulibaba

Hello Vinny,

  1. Please create a new JS file (Create New - JavaScript) with the following JS code prevar map;
    var markers = [];
    var group;
    var bounds = new google.maps.LatLngBounds();

    function initialize() {
    map = Apperyio("googlemap").gmap;

    if (!map){
    setDelay();
    }
    }

    function showMarkers(newMarkers){
    markers = [];

    for (var i = 0; i < newMarkers&#46;length; i++){
    var marker = new google&#46;maps&#46;Marker({
    position: {lat: newMarkers&#46;lat, lng: newMarkers&#46;lng},
    map: map,
    title: newMarkers&#46;title
    });
    markers&#46;push(marker);
    bounds&#46;extend(marker&#46;getPosition());
    }
    map&#46;fitBounds(bounds);

    }

    function setDelay()
    {
    setTimeout(initialize, 50);
    }/pre

  2. Run the JS code preinitialize();/pre on the page show event

  3. ANd add another code to the button's click event or any another you want to display markers:
    prevar markers = [
    {lat: 52&#46;520007, lng:13&#46;404954, title: "A title"},
    {lat: 51&#46;507351, lng:-0&#46;127758, title: "B title"},
    {lat: 37&#46;774929, lng:-122&#46;419416, title: "C title"},
    {lat: 35&#46;689487, lng:139&#46;691706, title: "D title"}
    ];
    showMarkers(markers);/pre