A light wight javascript image viewing plugin with smooth animation and 0 dependence

Overview

img-previewer

轻巧且强大的 javascript 图片预览插件,开箱即用,无需多余的配置.适用于任何网页页面,无需改变页面 html 代码结构

提供了常用的功能:

  1. 鼠标滚轮缩放图片
  2. 图标拖动图片
  3. 流畅的过渡动画
  4. 上一张&下一张

demo

预览

安装

npm

npm i img-previewer

或者 CDN https://cdn.jsdelivr.net/npm/[email protected]/dist/img-previewer.min.js

在 vue / react 中使用

//js
import ImgPreviewer from 'img-previewer'
//css
import 'img-previewer/dist/index.css'

const imgpreviewer = new ImgPreviewer(id,{options...})

options

说明 默认值
ratio 图片铺满预览区域的比例 0.9(90%)
scrollbar 是否自动隐藏滚动条 false
zoom 缩放图片的配置 {min: 0.1,max: 5,step: 0.1}
onInited 初始化完成后触发事件 -

options.zoom

说明 默认值
min 最小缩放比例 0.1(10%)
max 最大缩放比例 5(500%)
step 滚轮每次滚动变化的比例 0.1

更新图片

一些动态更新图片列表使用

const a = new ImgPreviewer('body')
// 图片渲染到页面后调用
a.update()
You might also like...

A very barebones editor that supports clicking on any pixel in a JPEG image to see the 64 DCT coefficients that make up that 8x8 block

A very barebones editor that supports clicking on any pixel in a JPEG image to see the 64 DCT coefficients that make up that 8x8 block

JPEG Sandbox This is a very barebones editor that supports clicking on any pixel in a JPEG image to see the 64 DCT coefficients that make up that 8x8

Jan 2, 2023

Doblar - a fully local image converter that runs in your browser

Doblar - a fully local image converter that runs in your browser

Doblar is a fully local image converter that runs in your browser. Doblar is purely client side: nothing is uploaded to a server or anything like that. All conversions take place in your browser, which means your files never leave your computer.

Dec 17, 2022

A simple image diff tool powered by avernakis.

A simple image diff tool powered by avernakis.

Image Diff English | 简体中文 Introduction This is the tutorial project of Avernakis UI. Tiny, but production ready. Install Use npm as nam! (Node App Man

Dec 3, 2022

jQuery plugin that blows your visitors' retinas

Dense.js Homepage | Issues | Dense is a jQuery plugin for serving retina-ready, high pixel ratio images with ease. Small, ease-to-adapt, yet very cust

Jun 30, 2022

A jQuery plugin that displays a thumbnail grid expanding preview similar to the effect seen on Google Images.

A jQuery plugin that displays a thumbnail grid expanding preview similar to the effect seen on Google Images.

jQuery GRIDDER 1.4.2 ======= A jQuery plugin that displays a thumbnail grid expanding preview similar to the effect seen on Google Images. We have all

Nov 6, 2022

jQuery plugin based on raphael.js that allows you to display dynamic vector maps

jQuery plugin based on raphael.js that allows you to display dynamic vector maps

jQuery Mapael - Dynamic vector maps The complete documentation is available on Mapael website (repository: 'neveldo/mapael-documentation'). Additional

Jan 5, 2023

A jquery plugin for comparing two images

A jquery plugin for comparing two images

jQuery Images Compare A jquery plugin for comparing two images Badges Features compatibility : ie9+ Effort to put appearance via css (easier to skin /

Sep 5, 2022

Picdit - Photo Editor is a web application created using HTML, CSS, PHP and JavaScript

Picdit - Photo Editor is a web application created using HTML, CSS, PHP and JavaScript

Picdit - Photo Editor is a web application created using HTML, CSS, PHP and JavaScript with the help VS Code and Microsoft Azure to develop the final project application outcome.

Mar 31, 2022

JavaScript library for object-based canvas drawing

oCanvas - Object-based canvas drawing oCanvas makes canvas development easier to understand and do, by creating a bridge between the native pixel draw

Jan 4, 2023
Comments
  • the ease out animation does work as expected when the target image is not shown in the first viewport.

    the ease out animation does work as expected when the target image is not shown in the first viewport.

    Demo Site: [DELETED]

    There are five images on the demo site, the first two images work well, but the last three images aren't be animated as wished when closing the preview layer. if you want the source code for debugging, I would be pleased to send it to you by email. last but not least, thanks for your great works on this awesome project.

    opened by akamemoe 5
  • Is it possible to show full preview image from the data attribute?

    Is it possible to show full preview image from the data attribute?

    Is it possible to show full preview image from the data attribute?

    <img src="image.jpg" data-preview="image-large.jpg" alt="my-image">

    opened by sojonatgithub 2
  • It loads all images!!

    It loads all images!!

    I tried it and works good enough. issue. There are 12 images in gallery, but it somehow counts images as 16 and loads even the logo in litebox. How can I avoid loading other images from the same page ?

    opened by shijilt 1
  • Preview `display none` image

    Preview `display none` image

    I want to have some hidden images and then show previewer programatically. so can we have a function like previewer.show(1) to show index one image? now it has some issues like getting width: 0 and height: 0

    enhancement 
    opened by sayjeyhi 1
Releases(2.1.6)
Unite Gallery - Responsive jQuery Image and Video Gallery Plugin. Aim to be the best gallery on the web on it's kind. See demo here:

##Unite Gallery - Responsive jQuery Gallery Plugin Product Link: unitegallery.net This gallery has commercial versions for: WordPress , Joomla! , Pres

Max Valiano 531 Oct 24, 2022
jQuery plugin that makes an image erasable (with mouse or touch movements)

jQuery.eraser v0.5.2 a jQuery plugin that makes an image erasable (with mouse or touch movements) This plugin replaces the targeted image by an intera

boblemarin 327 Oct 27, 2022
jQuery plugin for 'responsive cropping'. Dynamically crop images to fill available space without cutting out the image's subject. Great for full-screen images.

jQuery plugin for 'responsive cropping'. Dynamically crop images to fill available space without cutting out the image's subject. Great for full-screen images.

Jono Menz 3.2k Dec 30, 2022
Resize image in browser with high quality and high speed

pica - high quality image resize in browser Resize images in browser without pixelation and reasonably fast. Autoselect the best of available technolo

Nodeca 3.2k Dec 27, 2022
ASP.NET Core image gallery with Marten, ImageSharp, and HTMX

Image Gallery This sample uses the following core technologies to deliver an image gallery experience: ASP.NET Core Marten ImageSharp.Web HTMX This al

Khalid Abuhakmeh 11 Feb 9, 2022
:woman: Library for image processing

Lena.js Tiny library for image processing. Install via NPM npm install lena.js --save Install via yarn yarn add lena.js Run demo yarn demo Demo htt

Davidson Fellipe 558 Dec 28, 2022
Nivo Slider - The Most Awesome jQuery Image Slider

Maintainer's Wanted! - Ineterested in contributing regularly to Nivo Slider development? Get in touch Nivo Slider The Nivo Slider is world renowned as

Verti Studio 1.2k Dec 24, 2022
🌅 Content-aware image resizer based on Seam Carving algorithm

Content-aware image resizing might be applied when it comes to changing the image proportions (i.e. reducing the width while keeping the height) and when losing some parts of the image is not desirable.

Oleksii Trekhleb 1.4k Dec 30, 2022
Get the first frame of a Gif image.

Get the first frame of a Gif image.

lijialiang 3 Apr 8, 2022
An image post-processing code library

WebGPU image filter Preview online 这是一个用来展示 webgpu 在图片处理方面应用的 demo,但由于 webgpu API 还不稳定,本地都需要经常修改 API 才能跟上金丝雀的脚步,所以本项目的效果目前也还不稳定,目前仅供学习交流。

kuake 4 Mar 8, 2022