1
我一直在試圖製作一個圓整的Google地圖。我終於實現了它,這裏是的jsfiddle在Chrome上滾動時移動的Webkit掩碼
的問題是在鉻當我滾動,面具保持,而地圖上向下滾動同一個地方。
我已經在FF,opera opera和IE上測試過了,它的效果很好。它不僅僅是Chrome
的HTML是
<div id="wrapp">
<div id="mask">
<div id="anyotherID"></div>
</div>
</div>
的JS
window.onload=function(){
var myLatlngDist = new google.maps.LatLng(-32.242741,-60.161446);
geocoder = new google.maps.Geocoder();
directionsService = new google.maps.DirectionsService();
var mapOptionsDist = {
zoom: 4,
center: myLatlngDist,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
mapDist = new google.maps.Map(document.getElementById('anyotherID'), mapOptionsDist);
}
的CSS
#anyotherID{
height:427px;
width:428px;
-webkit-border-radius: 1000px;
-moz-border-radius: 1000px;
border-radius: 1000px;
overflow: hidden;
}
#mask {
border-radius: 1000px;
-moz-border-radius: 1000px;
-webkit-border-radius: 1000px;
overflow: hidden;
position: absolute; /* this breaks the overflow:hidden in Chrome/Opera */
/* this fixes the overflow:hidden in Chrome */
-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);
}
感謝您的幫助!