New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

lightimage

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lightimage

A lightweight image view plugin

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
29
163.64%
Maintainers
1
Weekly downloads
 
Created
Source

lightimage logo

🌈 A lightweight image view plugin

npm-v npm-d size

Example

Demo Page
PPAP

Intro

we can bind an element in the Lightimage object, and all children of the current element like <img/> can be viewed.

<div id="app">
  <img src="https://catbox.moe/pictures/qts/1512072270390.png">
  <div class="content">
    <img src="https://files.catbox.moe/jmai6s.png">
    <img src="https://files.catbox.moe/uh4owu.jpg">
    <img src="https://files.catbox.moe/bdo5nr.jpg">
  </div>
</div>

bind the element of #app, we can scale view all children of #app like <img/>

new Lightimage('#app').init()

bind the element of .content, we can scale view all children of .content like <img/>

new Lightimage('.content').init()

Browser Support

Chrome logoFirefox logoInternet Explorer logoEdge logoOpera logoSafari logo
38+ ✔️43+ ✔️10+ ✔️14+ ✔️32+ ✔️8+ ✔️

Install

CDN

<script src="https://cdn.jsdelivr.net/npm/lightimage/dist/lightimage.min.js"></script>
<script type="text/javascript">
  new Lightimage('#app').init()
</script>

NPM

npm i lightimage

Yarn

yarn add lightimage

Use

import Lightimage from 'lightimage'

new Lightimage('#app').init()

Attributes

AttributeDescriptionTypeDefault
cursormouse style of hover imagestringzoom-in
showAnimationDurationtransition time of show imagestring
maskLayerBgColorbackground color of mask layerstringrgba(0, 0, 0, 0.8)
showCloseBtnwhether to show the close buttonbooleanfalse
closeBtnHeightthe close button heightnumber48
closeBtnWidththe close button widthnumber48
closeBtnColorthe close button colorstring#9C9C9C
closeBtnBgColorthe close button background colorstringrgba(0, 0, 0, 0.2)

we can custom params like this :

new Lightimage('#app').init({
  cursor: 'zoom-in',
  showAnimationDuration: '0.8s',
  maskLayerBindClose: true,
  maskLayerBgColor: 'rgba(0, 0, 0, 0.9)',
  showCloseBtn: true, 
  closeBtnHeight: 48,
  closeBtnWidth: 48,
  closeBtnColor: '#9c9c9c',
  closeBtnBgColor: 'rgba(0, 0, 0, 0)'
})

License

MIT ©jwchan1996

Keywords

lightimage

FAQs

Package last updated on 15 Jun 2020

Related posts