Giter Club home page Giter Club logo

responsifyjs's Introduction

Responsify.js

A jquery plugin that makes images truly responsive, without sacrificing anyone's face :D

When images are used in a responsive container on web design, because of the container can change to any width:height ratio, a group shot could end up being cut off on people's faces, a nice photograph following "rule of third" could end up with no object in view. Responsive images face the challenge of how to keep the focused objects/area in view, this jquery plugin is here to solve the problem.

Download

Demo

https://responsifyjs.wentin.net/

App

https://responsifyjs.wentin.net/app

Use this interactive web app to generate the focus area data

What it does

Responsify.js does the following:

  1. It allows you define a focus area on an image using data-focus-xxx tag
  2. It takes in the focus area data from the image, calcuate the image's container's size, resize and position the image accordingly, make sure the focus area is always in view and in the best position possible.
  • Responsive image with responsify.js

with-s play it yourself

  • Responsive image without responsify.js

without-s play it yourself

How to use

  1. Use this interactive web app to generate the focus area data http://responsifyjs.space/app/
   <img src="image.png" alt="" 
   data-focus-left=".30" data-focus-top=".12" data-focus-right=".79" data-focus-bottom=".66" />

data-focus-left is the focus area's left position comparing to the image's full width, in decimal. For example, if the full width is 300px, the focus area's left is 90, then the data-focus-left should be 90/300 = 0.3. Same logic applies to other three data attributes.

  1. Embed the responsify.js in the html
   <script src="responsify.js"></script>
  1. Call responsify function when window object is loaded
   $(window).load(function() {
     $('img').responsify();
   });
  1. Call responsify function again when the window is being resized (optional)
  $(window).resize(function(){
    $('img').responsify();
  })

###Contact Me

###Other Project by Wentin

responsifyjs's People

Contributors

petty avatar wentin avatar wentin-adobe 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

responsifyjs's Issues

Add git tags.

Hi @wentin ,
We are cdnjs team, we're going to host this library.
The git auto-updater in cdnjs relies on git tags so that it can recognize the correct version and automatically update the repo.
Could you please add git tags for the repo? Thank you.

cdnjs/cdnjs#10644

Breaking Images

Just found this in 2018 and love the concept. Does it require a particular version of jQuery though? For me, it breaks the images by cutting off the cropped area. So when you resize smaller, then resize larger, the cropped area gets removed completely and becomes empty space.

Thanks in advance

screen shot 2018-03-12 at 6 32 27 pm

Need Support for jQuery version 3 or higher

Thank you for this nice script.

The Script doesn't work with jQuery version 3.3.1
Console shows the following failure: Uncaught TypeError: e.indexOf is not a function

Best regards.

Add the option for the equivalent of background-size: cover

It would be nice to prevent situation like in my screenshot:
image

where the first image doesn't cover the div completely (cropping the safe area, I know). You would still have your focus area centered. I will try to code it myself if I have the time.

Preload image into the helper App

Hi there,

Fantastic script, and love the helper app.

Is there a way to pre-load the current image and selected area into the helper app? So that the user can tweak existing settings rather than starting from scratch?

Thanks,
Dan

Consider publish as npm packages

Your component is helpful and seems promising.
Please publish as npm packages, so that many technologies can use your component (such as SharePoint Web Parts).

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.