Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
462 views
in Technique[技术] by (71.8m points)

javascript - 如何增加Google Map自动完成搜索下拉文本的字体大小?(How to increase font size for Google Map Autocomplete Search drop down text?)

I have a google map autocomplete search script with the API key and it works fine, however, the drop-down suggestions font is very small, the user can't see them.

(我有一个带有API密钥的google map自动完成搜索脚本,它工作正常,但是,下拉建议字体很小,用户看不到它们。)

Here's my script :

(这是我的脚本:)

<label for="fname" style="font-size:35px;font-family:verdana;margin-left:50px;">Enter Your Pick Up Address</label>
            <input type="text" class="autocomplete" style="text-decoration:none;font-size:35px;font-family:verdana;margin-left:50px;" id="ac2" name="pickup" required >

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=API KEY&amp;libraries=places"></script>
  <script type="text/javascript">//<![CDATA[

    var VanillaRunOnDomReady = function() {

function initialize() {

    var acInputs = document.getElementsByClassName("autocomplete");

    for (var i = 0; i < acInputs.length; i++) {

        var autocomplete = new google.maps.places.Autocomplete(acInputs[i]);
        autocomplete.inputId = acInputs[i].id;

        google.maps.event.addListener(autocomplete, 'place_changed', function () {
            document.getElementById("log").innerHTML = 'You used input with id ' + this.inputId;
        });
    }
}

initialize();

    }

var alreadyrunflag = 0;

if (document.addEventListener)
    document.addEventListener("DOMContentLoaded", function(){
        alreadyrunflag=1; 
        VanillaRunOnDomReady();
    }, false);
else if (document.all && !window.opera) {
    document.write('<script type="text/javascript" id="contentloadtag" defer="defer" src="javascript:void(0)"></script>');
    var contentloadtag = document.getElementById("contentloadtag")
    contentloadtag.onreadystatechange=function(){
        if (this.readyState=="complete"){
            alreadyrunflag=1;
            VanillaRunOnDomReady();
        }
    }
}

window.onload = function(){
  setTimeout("if (!alreadyrunflag){VanillaRunOnDomReady}", 0);
}

I tried playing with the input font-size CSS, but it does only affect the one that I am typing in it but not the dropdown suggestions.

(我尝试使用输入字体的CSS,但是它只会影响我在其中输入的CSS,而不会影响下拉菜单。)

Any help is greatly appreciated.

(任何帮助是极大的赞赏。)

  ask by Hareesh kumar translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use style="font-size: 50px;"

(使用style =“ font-size:50px;”)

where 50px will be the size.

(其中50px是尺寸。)

Use this on the attributte.

(在属性上使用它。)

eg: <div class="card" style="font-size: 50px;"

(例如: <div class="card" style="font-size: 50px;")


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...