Javascript 传单JS-外部控制

Javascript 传单JS-外部控制,javascript,jquery,leaflet,Javascript,Jquery,Leaflet,是否可以使用外部控件来缩放图像?我查阅了文档,但找不到可能的解决方案 HTML: JSFIDDLE: 多亏了SupunPraneeth,我用以下方法解决了这个问题: $('#plus').click(function () { map.setZoom(map.getZoom()+1) }) $('#minus').click(function () { map.setZoom(map.getZoom()-1) }) JSFIDDLE:map.setZoom呢?@S

是否可以使用外部控件来缩放图像?我查阅了文档,但找不到可能的解决方案

HTML:

JSFIDDLE:
多亏了SupunPraneeth,我用以下方法解决了这个问题:

 $('#plus').click(function () {
    map.setZoom(map.getZoom()+1)
  })
  $('#minus').click(function () {
    map.setZoom(map.getZoom()-1)
  })

JSFIDDLE:

map.setZoom呢?@SupunPraneeth嘿,好发现!我可以用$'plus'之类的东西来求解。单击函数{map.setZoommap.getZoom+1}$'minus'。单击函数{map.setZoommap.getZoom-1}
var map = L.map('image-map', {
  minZoom: 1,
  maxZoom: 4,
  center: [0, 0],
  zoom: 1,
  crs: L.CRS.Simple
});

var w = 2000,
    h = 1500,
    url = 'http://kempe.net/images/newspaper-big.jpg';

var southWest = map.unproject([0, h], map.getMaxZoom()-1);
var northEast = map.unproject([w, 0], map.getMaxZoom()-1);
var bounds = new L.LatLngBounds(southWest, northEast);

L.imageOverlay(url, bounds).addTo(map);

map.setMaxBounds(bounds);
map.scrollWheelZoom.disable();
 $('#plus').click(function () {
    map.setZoom(map.getZoom()+1)
  })
  $('#minus').click(function () {
    map.setZoom(map.getZoom()-1)
  })