Click here to Skip to main content
15,887,950 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to change the text size of a label which I have created by InfoBox in google maps. It is affecting the text but not text size. Here, what I have tried so far:

JavaScript
function addLabel(text,a,fontSize){
fontSz = fontSize + "pt";
            var myOptions = {
                 content: text
                ,boxStyle: {
                   border: "0px solid black "
                  ,textAlign: "center"
                  ,fontSize: fontSz
                  ,width: "50px"
                 }
                ,disableAutoPan: true
                ,pixelOffset: new google.maps.Size(-25, 0)
                ,position: a
                ,closeBoxURL: ""
                ,isHidden: false
                ,pane: "mapPane"
                ,enableEventPropagation: true
            };

            var ibLabel = new InfoBox(myOptions);
            ibLabel.open(map);
            return ibLabel;
    }


Here I call it inside a function..

JavaScript
if(label.length > 0){
            for( var j=0;j<xx.length;j++){
                label[j].setVisible(vis);
            }

        }else{//create and add new ones
            for( var j=0;j< xx.length;j++){
            alert(map.getZoom()+5);
                label[j] = addLabel(j+radars[j][1],new google.maps.LatLng(xx[j][2], xx[j][3]), map.getZoom()+5);
            }
        }


SQL
But the font size is not changing dynamically, Can somebody please help me?
Posted

1 solution

you Need to assign the size of the textbox
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900