0.7.0 • Published 7 years ago

panjs v0.7.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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.StringHTMLElementVoid
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 imageStringNullnull
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.

0.7.0

7 years ago

0.6.5

7 years ago

0.6.4

7 years ago

0.6.3

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago