代码
// 百度地图API功能
var map = new BMap.Map('map');
map.centerAndZoom(new BMap.Point(116.404, 39.915), 13);
map.enableContinuousZoom();
// map.enableScrollWheelZoom();
var b = new BMap.Bounds(
  new BMap.Point(116.127143, 39.772348),
  new BMap.Point(116.832025, 41.126349),
);
map.setBounds(b);

将地图显示范围设定在指定区域,地图拖出该区域后会重新弹回

预览