/SVGPan2

Zoom, pan and drag for SVG elements, no jQuery required

Primary LanguageJavaScript

SVGPan2

Zoom, pan and drag svg elements, no jQuery required. Demo: http://iamdanfox.github.io/SVGPan2/

Normal Usage

Add the SVGPan.js file to your page.

elem = document.getElementsByTagName('svg')[0]
var svgPan = SVGPan(elem)

Customise Options

var svgPan = SVGPan(elem, {
  enablePan: true,
  enableZoom: true,
  enableDrag: false,
  zoomScale: 0.2
})

You can even adjust options on the fly:

svgPan.enablePan = false

Remove Capabilities

svgPan.removeHandlers()

Credit

Based on work by Andrea Leofreddi