0.0.30 • Published 5 years ago

@jiubao/gallery v0.0.30

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

npm

gallery

  • 18k before gzip

Demo

Gestures

  • tap to open gallery
  • swipe to next or previous image
  • vertical pan to close
  • double tap to zoom in or zoom out
  • pinch to zoom in
  • pan to drag
  • pinch to zoom out or close

Install

$ npm install --save @jiubao/gallery
$ yarn add @jiubao/gallery
// using ES6 modules
import gallery from '@jiubao/gallery/dist/gallery.es'

The UMD build is available on unpkg:

<script src="https://unpkg.com/@jiubao/gallery"></script>

Usage

<div class="box">
  <img src="./imgs/1.jpg" data-gallery-item alt="">
  <img src="./imgs/2.jpg" data-gallery-item alt="">
  <img src="./imgs/3.jpg" data-gallery-item alt="">
  <img src="./imgs/4.jpg" data-gallery-item alt="">
  <img src="./imgs/5.jpg" data-gallery-item alt="">
</div>
import gallery from '@jiubao/gallery/dist/gallery.es'
gallery()

Options

AttributeDescriptionTypeDefaultValues
selectorgallery item flag, start with datastringdata-gallery-item

Methods

NameDescriptionParametersReturn
destroydestroy gallery
showshow galleryimg
hidehide gallery
onadd a event handlerevent name, event handlerunregister function
offremove handlerevent name, event handler

Events

NameDescriptiontriggerParameters
showshow gallery-img
hidehide gallery-img
singlesingle tap-points, target, phase, eventArg
doubledouble tap-points, target, phase, eventArg
scrollvertical scroll-points, target, phase, eventArg
scrollendvertical scroll end-points, target, phase, eventArg
pinchpinch move-points, target, phase, eventArg
pinchendpinch end-points, target, phase, eventArg
panpan move-points, target, phase, eventArg
panendpan end-points, target, phase, eventArg
postpanpost pan end-
starttouch start-points, target, phase, eventArg
movetouch move-points, target, phase, eventArg
endtouch end-points, target, phase, eventArg
swipestartswipe start-index
swipeswipe move-index
swipeendswipe end-index

Event handler arguments

NameDescription
pointsstart, last, current
targettarget img
phasegesture phase
eventArgtouch event argument

Todos

  • add api
  • add readme
  • two slide bug
  • need figure out a one step close solution
  • quick pan -> move back
  • pan trigger swipe
  • limit zoom in / out level
  • support wechat
  • support alipay
  • pan right () -> postpan -> tap (out) -> pan left -> post pan: a little slow
  • pan right () -> postpan -> tap (out) -> pan left -> post pan: super slow
  • destroy swiper (events, elements)
  • manage events
  • manage destroy
  • support landscape
  • switch to landscape
  • multi events on document
  • destroy & release
  • zoom out and zoom in: should not close
  • transparent issue
  • double and quickly swipe issue
  • triple tap
  • pinch trigger postpan
  • pan does not stop post pan animation
  • pan out of boundary stop issue
  • phone & scroll: not in middle issue
  • after scroll pinch break
  • pan accelerate & momentum
  • remove swiper's !important
  • gap between slides
  • disable swiper when gesture
  • disable gesture when swiper
  • ios / safari support
  • use js to simulate animation
  • pinch & pan: pending issue
  • pinch -> pan: twitter
  • quick pinch: strange behaviors (bounce back, move far away ...)
  • recover postpinch (current use postpan)
  • do we need post pinch?
  • window.resize: add a temp black bk, remove it after init
  • manage zoom
  • manage shape
  • manage animations
  • startSwiper | stopSwiper
  • gesture.on: support on an object
  • out of screen close animation
  • desktop
0.0.30

5 years ago

0.0.29

5 years ago

0.0.28

5 years ago

0.0.27

5 years ago

0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

6 years ago