New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jquery-svgpan

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery-svgpan

This plugin provides a jQuery hook to use Andrea Leofreddi's SVGPan library on an arbitrary number of SVGs.

0.1.6
latest
npm
Version published
Maintainers
1
Created
Source

jquery-svgpan

This is an an adaptation of Andrea Leofreddi's SVGPan library, version 1.2.2, for use as a jQuery plugin.

When called upon SVG element(s), this will add all the capabilities of Andrea Leofreddi's SVGPan library to those elements. Non-SVG elements will be silently ignored.

This is useful if you have SVG content sitting in the DOM. For example, if you are generating graphics via the d3 visualization library. It will not work if you are embedding the SVG through some other means.

See it in action!

Usage

You can configure the behaviour of the pan/zoom/drag by passing arguments.

  • viewportId: String ID of the root SVG element.
  • enablePan: Boolean enable or disable panning (default enabled)
  • enableZoom: Boolean enable or disable zooming (default enabled)
  • enableDrag: Boolean enable or disable dragging (default disabled)
  • zoomScale: Float zoom sensitivity, defaults to .2
    $(selector).svgPan(viewportId, enablePan, enableZoom, enableDrag, zoomScale);

Examples

This would enable SVGPan for all SVGs currently on the page. The element #viewport would be used as the viewport for each.

    $('svg').svgPan('viewport');

This would enable SVGPan for a single element (provided it is an SVG).

   $('#id').svgPan('viewport');

Andrea Leofreddi's original SVGPan library on Google code

Fork jquery-svgpan at

CDN jquery-svgpan from

Keywords

svg

FAQs

Package last updated on 11 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts