Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 使用google maps api设置表单样式_Css_Forms_Google Maps Api 3_Twitter Bootstrap 3 - Fatal编程技术网

Css 使用google maps api设置表单样式

Css 使用google maps api设置表单样式,css,forms,google-maps-api-3,twitter-bootstrap-3,Css,Forms,Google Maps Api 3,Twitter Bootstrap 3,我有一个GoogleMapsAPI以及2个输入和一个submit按钮,但是输入和submit按钮似乎没有正确的样式,也没有出现在地图上方的一行中。我还尝试将地图的位置和输入更改为绝对,但表单没有响应。我是这个领域的新手,请帮助我在不中断页面功能的情况下相应地设置页面样式 <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scal

我有一个GoogleMapsAPI以及2个输入和一个submit按钮,但是输入和submit按钮似乎没有正确的样式,也没有出现在地图上方的一行中。我还尝试将地图的位置和输入更改为绝对,但表单没有响应。我是这个领域的新手,请帮助我在不中断页面功能的情况下相应地设置页面样式

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
      <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

    <style>
      html, body  {
        height: 100%;
        width:100%;

      }
      .fluid-wrapper
      {
         position:relative;
         width:100%;
         height:100%;
      }

     #map-canvas
     {
      position:absolute;
       height:100%;
       width:100%;
     }


    </style>

     <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places"></script>

    <script>
   var poly, map,place,place1;
   var locations=new Array();
   var bounds=new google.maps.LatLngBounds();
function initialize() {
    var mapOptions = {
        center: new google.maps.LatLng(-33.8688, 151.2195),
        zoom: 13
    };
    map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

    var input = /** @type {HTMLInputElement} */
    (
    document.getElementById('input'));

    var input1 = (document.getElementById('input1'));


    map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
    map.controls[google.maps.ControlPosition.TOP_LEFT].push(input1);

    var autocomplete = new google.maps.places.Autocomplete(input);
    autocomplete.bindTo('bounds', map);

    var autocomplete1 = new google.maps.places.Autocomplete(input1);
    autocomplete1.bindTo('bounds', map);

    var infowindow = new google.maps.InfoWindow();
    var marker = new google.maps.Marker({
        map: map,
        anchorPoint: new google.maps.Point(0, -29)
    });

    var marker1 = new google.maps.Marker({
        map: map,
        anchorPoint: new google.maps.Point(0, -29)
    });
    var polyOptions = {
        strokeColor: '#000000',
        strokeOpacity: 1.0,
        strokeWeight: 3
    };
    poly = new google.maps.Polyline(polyOptions);
    google.maps.event.addDomListener(document.getElementById('submit'), 'click', function () {
    marker.setVisible(true);
    marker1.setVisible(true);
   // map.fitBounds(place.geometry.viewport);
    //map.setZoom(5);
    for (var i = 0, LtLgLen = locations.length; i < LtLgLen; i++) {
  //  And increase the bounds to take this point
  bounds.extend (locations[i]);
}
    map.fitBounds(bounds);
   //  map.setCenter(new google.maps.LatLng(((place.geometry.location.k+place1.geometry.location.k)/2),((place.geometry.location.D+place1.geometry.location.D)/2));
        poly.setMap(map);
    });

    google.maps.event.addListener(autocomplete, 'place_changed', function () {
        infowindow.close();
        marker.setVisible(false);
         place = autocomplete.getPlace();
        if (!place.geometry) {
            return;
        }

        // If the place has a geometry, then present it on a map.
        if (place.geometry.viewport) {
         //   map.fitBounds(place.geometry.viewport);
        } else {
            map.setCenter(place.geometry.location);
            map.setZoom(17); // Why 17? Because it looks good.
        }
        marker.setIcon( /** @type {google.maps.Icon} */ ({
            url: place.icon,
            size: new google.maps.Size(71, 71),
            origin: new google.maps.Point(0, 0),
            anchor: new google.maps.Point(17, 34),
            scaledSize: new google.maps.Size(35, 35)
        }));
        marker.setPosition(place.geometry.location);
        locations.push(place.geometry.location);
       // marker.setVisible(true);
        poly.getPath().setAt(0, marker.getPosition());
     //  var myLatLng=(place.geometry.location.k,place.geometry.location.D);
       //bounds.extend(myLatLng);
        var address = '';
        if (place.address_components) {
            address = [
            (place.address_components[0] && place.address_components[0].short_name || ''), (place.address_components[1] && place.address_components[1].short_name || ''), (place.address_components[2] && place.address_components[2].short_name || '')].join(' ');
        }

      //  infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + address);
       // infowindow.open(map, marker);
    });

    google.maps.event.addListener(autocomplete1, 'place_changed', function () {
        infowindow.close();
        marker1.setVisible(false);
        place1 = autocomplete1.getPlace();
        if (!place1.geometry) {
            return;
        }

        // If the place has a geometry, then present it on a map.
        if (place1.geometry.viewport) {
            //map.fitBounds(place1.geometry.viewport);
        } else {
            map.setCenter(place1.geometry.location);
            map.setZoom(11); // Why 17? Because it looks good.
        }
        marker1.setIcon( /** @type {google.maps.Icon} */ ({
            url: place1.icon,
            size: new google.maps.Size(71, 71),
            origin: new google.maps.Point(0, 0),
            anchor: new google.maps.Point(17, 34),
            scaledSize: new google.maps.Size(35, 35)
        }));
        marker1.setPosition(place1.geometry.location);
        locations.push(place1.geometry.location);
      //  marker1.setVisible(true);
        poly.getPath().setAt(1, marker1.getPosition());
        //var myLatLng=(place1.geometry.location.k, place1.geometry.location.D);
       //bounds.extend(myLatLng);
        var address = '';
        if (place1.address_components) {
            address = [
            (place1.address_components[0] && place1.address_components[0].short_name || ''), (place1.address_components[1] && place1.address_components[1].short_name || ''), (place1.address_components[2] && place1.address_components[2].short_name || '')].join(' ');
        }

      //  infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + address);
      //  infowindow.open(map, marker1);
    });


}
google.maps.event.addDomListener(window, 'load', initialize);
    </script>
  </head>
  <body>
  <div class="fluid-wrapper">
<nav class="navbar navbar-default">
<div class="nav navbar-nav">
<div class="pull-left">
   <input id="input" class="form-control" type="text" placeholder="Enter a location" style="width:300px; height:30px;border-width:2px;
 border-style:solid; margin-top:10px;padding-left:4px;"  />

     <input id="input1" class="form-control" type="text" placeholder="Enter another location" style="width:300px; height:30px;margin-  left:20px;margin-top:10px; border-width:2px;
 border-style:solid; padding-left:4px;"/>
 </div>
 </div>
 <div class="nav navbar-nav">
 <div class="pull-right">
    <input type="submit" class="btn btn-info" name="submit" id="submit" value="SUBMIT" style="margin-left:720px;margin-top:-18px;" />
</div>
</div>
</nav>

<div class="map_canvas" id="map-canvas"></div>
  </div>
 </body>
 </html>

html,正文{
身高:100%;
宽度:100%;
}
.液体包装
{
位置:相对位置;
宽度:100%;
身高:100%;
}
#地图画布
{
位置:绝对位置;
身高:100%;
宽度:100%;
}
变量poly,map,place,place1;
变量位置=新数组();
var bounds=new google.maps.LatLngBounds();
函数初始化(){
变量映射选项={
中心:新google.maps.LatLng(-33.8688151.2195),
缩放:13
};
map=new google.maps.map(document.getElementById('map-canvas'),mapOptions);
变量输入=/**@type{HTMLInputElement}*/
(
document.getElementById('input');
var input1=(document.getElementById('input1');
map.controls[google.maps.ControlPosition.TOP_LEFT].push(输入);
map.controls[google.maps.ControlPosition.TOP\u LEFT].push(input1);
var autocomplete=new google.maps.places.autocomplete(输入);
autocomplete.bindTo('bounds',map);
var autocomplete1=新的google.maps.places.Autocomplete(input1);
自动完成1.bindTo('bounds',map);
var infowindow=new google.maps.infowindow();
var marker=new google.maps.marker({
地图:地图,
主播点:新google.maps.Point(0,-29)
});
var marker1=新的google.maps.Marker({
地图:地图,
主播点:新google.maps.Point(0,-29)
});
var多选项={
strokeColor:“#000000”,
笔划不透明度:1.0,
冲程重量:3
};
poly=新的google.maps.Polyline(多选项);
google.maps.event.addDomListener(document.getElementById('submit'),'click',函数(){
marker.setVisible(true);
marker1.setVisible(true);
//map.fitBounds(place.geometry.viewport);
//map.setZoom(5);
对于(var i=0,LtLgLen=locations.length;i”+place.name+”
“+地址); //信息窗口。打开(地图、标记); }); google.maps.event.addListener(自动完成1,'place\u changed',函数(){ infowindow.close(); marker1.setVisible(假); place1=autocomplete1.getPlace(); 如果(!place1.几何体){ 返回; } //如果该地点有几何图形,则将其显示在地图上。 if(place1.geometry.viewport){ //map.fitBounds(place1.geometry.viewport); }否则{ 地图。设置中心(位置1。几何。位置); map.setZoom(11);//为什么是17?因为它看起来不错。 } marker1.setIcon(/**@type{google.maps.Icon}*/({ url:place1.icon, 大小:新谷歌地图大小(71,71), 来源:新google.maps.Point(0,0), 主播:新google.maps.Point(17,34), scaledSize:新的google.maps.Size(35,35) })); 标记1.设置位置(位置1.几何图形.位置); 位置。推(位置1。几何。位置); //marker1.setVisible(true); poly.getPath().setAt(1,marker1.getPosition()); //var mylatng=(place1.geometry.location.k,place1.geometry.location.D); //扩展(myLatLng); var地址=“”; if(位置1.地址\组件){ 地址=[ (place1.address_components[0]&&place1.address_components[0],(place1.address_components[1]&&place1.address_components[1],(place1.address_components[2]&&place1.address_components[2],(place1.address_components[2],(place1.address| components[2],(place1.address| components)]。加入(“”); } //infowindow.setContent(“”+place.name+”
“+地址); //打开(地图,标记1); }); } google.maps.event.addDo