GithubHelp home page GithubHelp logo

yue1123 / img-previewer Goto Github PK

View Code? Open in Web Editor NEW
57.0 57.0 10.0 3.01 MB

A light wight javascript image viewing plugin with silky preview animation and dependence free

Home Page: https://yue1123.github.io/img-previewer/demo/index.es.html

License: MIT License

JavaScript 2.69% TypeScript 71.59% HTML 10.40% Less 15.32%
animation gallery github-stars image javascript lightbox lightbox-gallery photo previewer typescript

img-previewer's Introduction

img-previewer's People

Contributors

yue1123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

img-previewer's Issues

Allowing the ImgPreviewer to allow Elements

Hey!

I have been using this awesome package to work with my project but I have hit a issue which I think would be a great addition to your package.

When passing in paramaters to the ImgPreviewer() it only allows for "selector" right now. I think being able to pass in HTMLElement would make things much easier when dealing with logic around initalising the lightboxes.

My use case:

const lightboxes = $(".lightbox");

if (lightboxes.length > 0) {
  lightboxes.each((index, lightbox) => {
    new ImgPreviewer(lightbox, {
      fillRatio: 0.7,
      imageZoom: {
        step: 1,
      },
      style: {
        modalOpacity: 0.8,
        headerOpacity: 1,
        zIndex: 1,
      },
      bubblingLevel: 1,
      onClose: () => {},

      triggerEvent: "click",
      onShow: () => null,
    });
  });
}

Let me know if this sounds like something you might be interested in!

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

Solution for separate thumbnail/preview resolution

Hey! Came across this project today when on the lookout for an image lightbox that suits my needs.

The issue I ended up having is that it relies on images being loaded on the page at preview size i.e. at a larger size than they need to be in the context of the page layout, which is an obvious downnside re: performance.

Perhaps this can be solved with an enhancement that leverages a larger image path in a data attribute, or similar (this seems to be the way other libs handle it, at least).

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 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.