本文介绍了动态更改字体大小google maps-InfoBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改我在Google地图中使用InfoBox创建的标签的文字大小。它影响文本但不影响文本大小。在这里,我到目前为止尝试过:



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:

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..

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);
            }
        }







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

推荐答案


这篇关于动态更改字体大小google maps-InfoBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 07:03