You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

panjs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

panjs

Modern, tiny library for paning images without dependencies

0.7.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

panJS

Build Status Coverage Status Sauce Test Status

Description

Pan images without dependencies

Install with npm

npm install --save panjs

Install with bower

bower install panjs --save

Usage

Prerequisited markup

<div class="img-wrapper">
    <img src="/path/to/image.jpg" alt="">
</div>

Prerequisited css

.img-wrapper {
  overflow: hidden;
}

Integration

  import panjs from 'panjs';
  var wrapper = document.querySelectorAll('.img-wrapper');

  panjs(wrapper, {
    // options going here, at the moment we do not support any options
  });

Public API

NameDescriptionargumentsreturns
setupinds eventlisteners, merging default and user options, setup the pan based on DOM (called once during initialisation). Call setup if DOM or user options have changed or eventlisteners needs to be rebinded.StringHTMLElement
resetSets the pan back to the starting position or position passed to methodObjectVoid
destroyResets and destroys the panjs instance by removing all panjs specific event listenersVoid
offsetGet the current offset, values between 0 - 1Object

Options

NameDescriptionTypeDefault
targetIf multiple images are inside wrapper, pass a target css selector to select the preferred imageStringNull
offsetStart offset for inner image, between 0 - 1Object{ x: 0, y: 0 }
xAxisLockAbility to lock x-axisBooleanfalse
yAxisLockAbility to lock y-axisBooleanfalse
speedSpeed on returning to default state when calling reset or destroyNumber0
easingKind of css easing on returning to default state when calling reset or destroyStringease

Browser support

Sauce Test Status

Note: If you attend to use this module with older browser its mandatory to polyfill both Array.from and `Object.assign

License

MIT. Copyright (c) 2016 Philip Knape.

Keywords

pan

FAQs

Package last updated on 15 Jun 2017

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