您好我使用引导程序模板显示一些地图工具但是当我折叠侧面板时地图移动到正确的位置但是活空白时我遇到了包含地图画布的div的css问题在另一边,地图的高度也存在很大的问题。
我希望在侧面板折叠或扩展时尝试将地图完全展开,但没有成功,我将非常感谢stackoverflow社区提供的任何帮助。
提前致谢。
这是指向我的信息页https://secure.cevamhn.net/AirAid/maptoolsair.php
的链接css代码:
/*!
* Start Bootstrap - Simple Sidebar HTML Template (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
/* Toggle Styles */
#wrapper {
padding-left: 0px;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#wrapper.toggled {
padding-left: 0px;
}
#sidebar-wrapper {
z-index: 1000;
position: fixed;
left: 250px;
width: 0; /* disini agar ketika di kecilkan tidak hilang semua default 0*/
height: 100%;
margin-left: -250px;
overflow-y: auto;
background: #000;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#wrapper.toggled #sidebar-wrapper {
width: 250px;
}
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 0px;
}
#wrapper.toggled #page-content-wrapper {
position: absolute;
margin-right: -150px;
}
/*------------------------------------------------ MAP FEATURES BEGIN ----------------------------------*/
#map-canvas {
height: 100%;
width: 100%;
margin-left: 0px;
padding: 0px;
}
#drawPanel {
position: absolute;
width: 200px;
font-family: Arial, sans-serif;
font-size: 13px;
float: left;
margin-top: 5px;
margin-left: 200px;
z-index: 1000;
}
#color-palette {
clear: both;
}
.color-button {
width: 20px;
height: 20px;
font-size: 0;
margin: 2px;
float: left;
cursor: pointer;
}
#delete-button {
margin-top: 0px;
margin-left: 22px;
}
#wrapper.toggled #map-canvas #drawPanel #color-palette.color-button #delete-button {
position: absolute;
}
#botLeft{
color: red;
font-weight: bold;
border: 0px solid;
background-color: transparent;
}
#botRight{
color: red;
font-weight: bold;
border: 0px solid;
background-color: transparent;
}
input {
color: White;
font-weight: bold;
border: 0px solid;
background-color: transparent;
text-align: left;
}
#opacity {
color: black;
font-weight: bold;
background-color: white;
width: 30px;
height: 20px;
margin-left: 5px;
}
/*------------------------------------------------ END MAP FEATURES ----------------------------------*/
.fixed-brand{
width: auto;
}
/* Sidebar Styles */
.sidebar-nav {
position: absolute;
top: 0;
width: 250px;
margin: 0;
padding: 0;
list-style: none;
margin-top: 2px;
}
.sidebar-nav li {
text-indent: 15px;
line-height: 40px;
}
.sidebar-nav li a {
display: block;
text-decoration: none;
color: #999999;
}
.sidebar-nav li a:hover {
text-decoration: none;
color: #fff;
background: rgba(255,255,255,0.2);
border-left: red 2px solid;
}
.sidebar-nav li a:active,
.sidebar-nav li a:focus {
text-decoration: none;
}
.sidebar-nav > .sidebar-brand {
height: 65px;
font-size: 18px;
line-height: 60px;
}
.sidebar-nav > .sidebar-brand a {
color: #999999;
}
.sidebar-nav > .sidebar-brand a:hover {
color: #fff;
background: none;
}
.no-margin{
margin:0;
}
@media(min-width:768px) {
#wrapper {
padding-left: 250px;
}
.fixed-brand{
width: 250px;
}
#wrapper.toggled {
padding-left: 0;
}
#sidebar-wrapper {
width: 250px;
}
#wrapper.toggled #sidebar-wrapper {
width: 250px;
}
#wrapper.toggled-2 #sidebar-wrapper {
width: 50px;
}
#wrapper.toggled-2 #sidebar-wrapper:hover {
width: 250px;
}
#page-content-wrapper {
padding: 0px;
position: relative;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#map-canvas {
padding: 442px; /* ------------------------------- If left at 0 Map is not Display ---------------------- */
position: relative;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#wrapper.toggled #page-content-wrapper {
position: relative;
margin-right: 0;
padding-left: 200px;
}
#wrapper.toggled #map-canvas #map-canvas {
position: relative;
margin-right: 0px;
padding-left: 0px;
}
#wrapper.toggled-2 #page-content-wrapper {
position: relative;
margin-right: 0px;
margin-left: -220px;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#wrapper.toggled-2 #map-canvas #map-canvas #drawPanel #color-palette.color-button #delete-button {
position: relative;
margin-right: 0px;
margin-left: 0px;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
}
答案 0 :(得分:0)
当包含地图的div的大小发生变化时,您需要在Map对象上触发'resize'事件。
google.maps.event.trigger(map, 'resize');
另外,通过更改:
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 0px;
}
为:
#page-content-wrapper {
min-width: 100%;
position: absolute;
padding: 0px;
}
元素保持空间的宽度。