Coder Social home page Coder Social logo

zoom.js's Introduction

ZOOM.JS

npm (scoped)

A pure JavaScript image zooming plugin; as seen on Medium.com.

Has no jQuery or Bootstrap dependencies.

This is a port of the original version by @fat: https://github.com/fat/zoom.js.

Usage

You can use zoom.js directly as a script, or install via npm.

Direct

  1. Link the zoom.js and zoom.css files to your site or application.
<link href="css/zoom.css" rel="stylesheet">
<script src="dist/zoom.js"></script>
  1. Add a data-action="zoom" attribute to the images you want to make zoomable. For example:
<img src="img/blog_post_featured.png" data-action="zoom">

Via npm

  1. Install the package: npm i @nishanths/zoom.js
  2. Link the zoom.css file to your application.
 <link href="css/zoom.css" rel="stylesheet">
  1. Import the package and call zoom.setup(elem) for each image you want to make zoomable.
import { zoom } from "@nishanths/zoom.js";

var imgElem = new Image();
imgElem.src = "tree.png";
document.body.appendChild(imgElem);

zoom.setup(imgElem);

Demo

https://nishanths.github.io/zoom.js

gif

Notes

It has the same behavior and all the features from the original implementation. But:

* In addition to the dist/ scripts, it's available as an npm module.
* Browser compatibility may be lower. Uses the transitionend event without
  vendor prefixes, so IE 10 or higher.

License

Original license

This is a fork of the original zoom.js implementation by @fat. Copyrights for the original project are held by @fat. All other copyright for changes in the fork are held by Nishanth Shanmugham.

Copyright (c) 2013 @fat The MIT License. Copyright © 2016 Nishanth Shanmugham.

zoom.js's People

Contributors

nishanths avatar fat avatar nielthiart avatar sethherr avatar kittygiraudel avatar blackheart340 avatar joe-callon avatar theskumar avatar cpommiss avatar

Watchers

Thiago Magalhães avatar James Cloos avatar  avatar

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.