A jquery plugin that makes images truly responsive, without sacrificing anyone's face. Give it more stars!

Overview

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

Comments
  • Need Support for jQuery version 3 or higher

    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.

    opened by havutcuoglu 1
  • Add the option for the equivalent of background-size: cover

    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.

    opened by freedompower 0
  • Automatic redirect to https leads to mixed content and breaks your demo page

    Automatic redirect to https leads to mixed content and breaks your demo page

    Your domain is automatically redirected to https and therefore cannot load jquery from Cloudflare because of mixed content in current browsers. Therefore the demo is completely broken.

    opened by tpinne 0
  • Consider publish as npm packages

    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).

    opened by radityoardi 0
  • Breaking Images

    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
    opened by dungle-scrubs 0
  • Add git tags.

    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.

    https://github.com/cdnjs/cdnjs/issues/10644

    opened by pvnr0082t 0
Owner
Wenting Zhang
Wenting Zhang, designer @adobe, play.typedetail.com source.typekit.com , cssicon.space , typedetail.com , underline.js
Wenting Zhang
High performance and SEO friendly lazy loader for images (responsive and normal), iframes and more, that detects any visibility changes triggered through user interaction, CSS or JavaScript without configuration.

lazysizes lazysizes is a fast (jank-free), SEO-friendly and self-initializing lazyloader for images (including responsive images picture/srcset), ifra

Alexander Farkas 16.6k Jan 1, 2023
Kaol Stack - Prisma, Expo, Next, TRPC, Solito, Tailwind - A monorepo template for a truly universal app

Kaol Stack ?? About A monorepo with Prisma, Next.js, Expo, tRPC, Authentication and Solito setup and configured to work together. With this setup you

Matheus Vicente 187 Dec 21, 2022
📷 Detects your face and adds filters from your webcam. You can capture and download images.

Snapchat Filters on WebCam ?? Detects your face and adds filters from your webcam. You can capture and download images. ?? Visit site ?? Screenshots ?

Orhan Emre Dikicigil 2 Apr 27, 2022
Responsive Tabs is a jQuery plugin that provides responsive tab functionality.

Responsive Tabs is a jQuery plugin that provides responsive tab functionality. The tabs transform to an accordion when it reaches a CSS breakpoint. You can use this plugin as a solution for displaying tabs elegantly on desktop, tablet and mobile.

Jelle Kralt 537 Dec 8, 2022
Simple jQuery plugin that will allow users to zoom in your images, perfect for product images and galleries.

Image Zoom (jQuery) Plugin Simple jQuery plugin that will allow users to zoom in your images, perfect for product images and galleries that is less th

Mario Duarte 8 Aug 3, 2022
Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party library!

PI Calculator Web JS (Online) Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party

Max Base 6 Jul 27, 2022
Responsive no-jQuery pure JS/CSS Lightbox for images, no dependencies, 10kb unminified source code, with demo

img-lightbox Responsive no-jQuery pure JS/CSS Lightbox for images, no dependencies, 10kb unminified source code, with demo Demo codepen jsfiddle jsbin

englishextra 12 Jun 13, 2022
Responsive tabs-to-accordion script without jQuery, written using pure JavaScript

vanilla-tabs Responsive tabs-to-accordion script without jQuery, written using pure JavaScript Author Dmytro Kudleichuk LinkedIn GitHub Online Demo Se

Dmitriy Kudleichuk 7 Dec 20, 2022
Display an image in a responsive imagebox without jQuery.

Documentation ImageBox latest version 1.3.0 Include this files: <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/tobiasroeder/[email protected]/d

Tobias Röder 5 Aug 31, 2021
A Browser extension that not only makes your browsing experience safe but makes it optimized

Sia Sia is a browser extension that not only makes your browsing experience safe but makes it optimized Table of Contents About The Project Built With

Arun Govind M 14 Feb 23, 2022
A JavaScript module that shortens your code, makes life easier, and makes development faster!

Quxt A JavaScript module that shortens your code, makes life easier, and makes development faster! Installation npm install quxt Quick Start Check ind

Qux App 5 May 8, 2022
Get the latest feed of GitHub Stars out there! 🌟 ⭐ ✨

GitHub Stars Feed Get the latest feed of GitHub Stars out there! ⭐ The GitHub Stars program thanks GitHub’s most influential developers and gives them

Vinit Shahdeo 30 Oct 5, 2022
A Leaderboard that shows who has given your stars to your repositories

A Leaderboard that shows who has given your stars to your repositories

Victor Peralta 6 Mar 22, 2022
Complete module to interact with the Brawl Stars API.

BrawlStars-API.js Brawlstars-api.js is a library made to interact with the Official Brawl Stars api, listing all of their endpoints in one place. ✨ Ho

Nícolas Gabriel 4 Nov 3, 2022
Uma aplicação pomodoro conectada com a API do Spotify, para tornar o seu estudo mais dinâmico. Topics Stars

Demo | Tecnologias | Iniciando | Projeto | Layout | Demo ?? Tecnologias Esse projeto foi feito com as seguintes tecnologias. NextJS Next Auth TypeScri

Sophia Gallindo 26 Aug 9, 2022
Stars Dulu, Baru Fork!

Dev-3S-Bot 3S~Bot MD Untuk bertanya atau melaporkan bug pribadi Email: [email protected] In Project: Werewolf Presence Update Pokemon Fish Em

ᵈʳᴋᴏᴋᴏ ᴘᴀ፝֟፝֟ɴɢᴇʀᴀɴ 5 Dec 2, 2022
Find related repository by stars.

Related Repos Find related repository by stars. How it works? By analyzing the star activities of users who have starred a specific repository, this t

JustSong 7 May 10, 2023
Silahkan di fork dan jangan lupa stars.nya ya bro...

Chat OWNER Chat BOT (Aktif) BERKAHESPORT.ID OFFICIAL Terimakasih Untuk ALLAH S.W.T. Serta junjungan kami nabi Muhammad S.A.W WhatsappBOT ini menggunak

null 9 May 9, 2023