2011-11-17 74 views

回答

0

你可以讓你自己的按鈕和點擊呼叫

map.getStreetView().setVisible(false); 
0

你可以嘗試以下

CSS

.btn { 
    margin-top: 2rem; 
    background: #3498db; 
    background-image: -webkit-linear-gradient(top, #3498db, #2980b9); 
    background-image: -moz-linear-gradient(top, #3498db, #2980b9); 
    background-image: -ms-linear-gradient(top, #3498db, #2980b9); 
    background-image: -o-linear-gradient(top, #3498db, #2980b9); 
    background-image: linear-gradient(to bottom, #3498db, #2980b9); 
    -webkit-border-radius: 28; 
    -moz-border-radius: 28; 
    border-radius: 28px; 
    font-family: Arial; 
    color: #ffffff; 
    font-size: 20px; 
    padding: 10px 20px 10px 20px; 
    text-decoration: none; 
} 

.btn:hover { 
    background: #3cb0fd; 
    background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db); 
    background-image: -moz-linear-gradient(top, #3cb0fd, #3498db); 
    background-image: -ms-linear-gradient(top, #3cb0fd, #3498db); 
    background-image: -o-linear-gradient(top, #3cb0fd, #3498db); 
    background-image: linear-gradient(to bottom, #3cb0fd, #3498db); 
    text-decoration: none; 
} 

HTML

<button id="closeStreetView" class="btn">Click me</button> 

的Javascript

var closeButton = document.querySelector('#closeStreetView'), 
controlPosition = google.maps.ControlPosition[config.streetViewCloseButtonLocation]; 
var streetView = map.getStreetView(); 
    streetView.setOptions({ enableCloseButton: false }); 
    streetView.controls[ controlPosition ].push(closeButton); 
    google.maps.event.addDomListener(closeButton, 'click', function(){ 
    streetView.setVisible(false);