Error in javascript code (import google maps)

Asked

Viewed 19 times

0

I see in the console from the browser that shows the following error:

Uncaught Referenceerror: Lat is not defined addMarker (functions.js:17) at window.onload (functions.js:44) [email protected]:17 window.onload @functions.js:44 load (async) (Anonymous) @functions.js:1

Can someone help me?

window.onload = function (){
    var map;

    function initialize(){
        var mapProp = {
            center: new google.maps.LatLng(-23.188700,-45.759449),
            scrollwheel:false,
            zoom:12,
            mapTypeId:google.maps.MapTypeId.ROADMAP
        }

        map = new google.maps.Map(document.getElementById("mapa"),mapProp);
    }

    function addMarker(lat,long,icon,content){
        var LatLng = {'Lat':Lat,'Lng':Long};

        var marker = new google.maps.Marker({
            position:LatLng,
            map:map,
            icon:icon
        });

        var infoWindow = new google.maps.infoWindow({
            content:content,
            maxWidth:200,
            pixelOffset: new google.maps.Size(0,20)
        });

        if(click == true){
            google.maps.event.addListener(marker,'click',function(){
                infoWindow.open(map,marker);                
            });
        }else{
            infoWindow.open(map,marker);
        }

    }

    initialize();

    var conteudo = '<p style="color:black;font-size:13px;padding:10px 0;border-bottom:1px solid black;"'
    addMarker(-23.188700,-45.759449,'',conteudo)


}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.