加载谷歌地图后PhoneGap水平滚动

时间:2015-04-28 06:17:51

标签: android cordova google-maps-api-3 phonegap-plugins horizontal-scrolling

我正在使用 PhoneGap 来构建Android应用 身体中有div标签:

#map {
overflow-x: hidden;
background: none repeat scroll 0 0 #ffffff;
height: 25%;
background-color: transparent;
background-repeat: no-repeat;
/*background-attachment: scroll;*/
background-position: center center;
background-clip: border-box;
background-origin: padding-box;
background-size: 100% 100% !important;
width: 90%;
margin: 0;
display: inline-block;

css

function showMap(title, lat, lng){
setLog('ShowMap begin ...');
setLog('ShowMap title : ' + title + ' , lat : ' + lat + ' , lng : ' + lng);
var locations = [
    [''+title, lat, lng, 1]
];
var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 13,
    center: new google.maps.LatLng(lat, lng),
    mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infoWindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
    marker = new google.maps.Marker({
        position: new google.maps.LatLng(locations[i][1], locations[i][2]),
        map: map
    });
    google.maps.event.addListener(marker, 'click', (function(marker, i) {
        return function() {
            infoWindow.setContent(locations[i][0]);
            infoWindow.open(map, marker);
            }
        })(marker, i));
        }
}

}

js

body {
    overflow-x: hidden;
}

加载谷歌地图后,它会进行水平滚动

以下css无效

employees

甚至#map width设置为50%但是进行水平滚动

我该如何解决?

0 个答案:

没有答案