365

GitHub - charlestati/amplify: A tiny script allowing inline image zoom

 6 years ago
source link: https://github.com/charlestati/amplify
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Amplify

Overview

Amplify allows users to increase the size of images.

Best used in narrow containers, between paragraphs.

It is lightweight: 29 sloc of JS and 23 sloc of SCSS resulting in 1.22kB combined.

Demo

Quickstart

<img class="js-amplify" src="photo.jpg" alt="Photo">

Browser Support

  • Chrome
  • Firefox
  • Safari

Probably Edge, Internet Explorer 10+ and Opera too.

Known bugs

  • Sometimes the first transition is not smooth
  • Adding a wrapper for image centering prevents margin collapsing with the paragraphs
  • Use transform: scale() or JavaScript for smoother transitions
  • Find a better naming system as .js-* in CSS is not ideal

License

Apache 2.0


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK