Giter Club home page Giter Club logo

zoom.js's People

Contributors

nishanths 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zoom.js's Issues

CSS opacity transition onClose is missing

to get the opacity transition to work at the end, it should read smtg like:

.zoom-overlay {
  opacity: 0;
  -webkit-transition:      opacity 300ms ease-in-out;
       -o-transition:      opacity 300ms ease-in-out;
          transition:      opacity 300ms ease-in-out;
}
.zoom-overlay-open .zoom-overlay {
  opacity: 1;
}
.zoom-overlay-transitioning .zoom-overlay {
  opacity: 0;
}

.zoom-overlay-open is remove at transitionEnd.

Enhance to function as a lightbox

I like the simplicity of this library and was considering using it. But it is not the same technique that medium uses to zoom images. They use the lightbox technique which requires 2 versions of the same image; a scaled-down version which is loaded by default and zoomed to the full-size version that is loaded upon click. Like this:

    <a href="full.jpg">
        <img src="thumb.jpg" />
    </a>

In fact, a webpage using zoom.js will be penalized by google's search ranking algorithm for inefficiently formatting images.

https://developers.google.com/speed/pagespeed/insights/?url=https://nishanths.github.io/zoom.js/

Do you have plans to further develop this? I think it would be great it if had the ability to zoom from a scaled-down image to a full-size image. The API could stay the same:

    zoom.setup(elem);

Where elem is either a normal img element, or it could be an anchor element wrapping an img element, as above. If an img element, it functions exactly as it does now. If an anchor element, it functions as a lightbox.

docs: add example of how to simulate fat/zoom.js default behavior

import { Config, zoom } from "@nishanths/zoom.js"

const cfg: Config = {
		padding: 80,
		paddingNarrow: 80,
		dismissScrollDelta: 40,
		dismissTouchDelta: 40,
}

for (const img of document.querySelectorAll<HTMLImageElement>(`img[data-action="zoom"]`)) {
	img.classList.add("zoom-cursor")
	img.addEventListener("click", (e) => {
		if (e.metaKey || e.ctrlKey) {
			window.open(img.src, "_blank")
			return
		}
		img.dataset.action = "zoom-out"
		zoom(img, cfg)
		img.dataset.action = "zoom"
	})
}

Adding image description

If you could please add a data-description or like field to describe and show the users what the image is about. Thanks

Edge compability

I set up a minimum page, and it seems to work fine in all major browsers...except edge. When clicking an image, it zooms in correctly, but when zooming out all other content is gone from the webpage.

Use a larger image

@nishanths Have you been thinking about using another image to zoom?

When the original image is very small it make no sense to zoom it.

Copyright

If this is ported from @fat, shouldn't you include his copyright line in your MIT license?

Build UMD version

It would be easier to work with webpack and single page app, and init it manually:

import zoom from 'zoom.js'

zoom.setup(document.querySelectorAll('.my-els'))

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.