var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var screenHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
console.log("当前屏幕分辨率: " + screenWidth + "x" + screenHeight);
const height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
if (height >= 961) { // 100%
padding = 300
} else if (height >= 746) { // 125%
padding = 100
} else { // 大于125%
padding = 0
}
map.fitBounds(bound, {
duration: 1000,
padding
})
在不同的分辨率下给geojson不同的padding