All Projects → matthisk → Respify

matthisk / Respify

Licence: MIT License
Respify responsive image library

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to Respify

Sms Responsive Images
This TYPO3 extension provides ViewHelpers and configuration to render valid responsive images based on TYPO3's image cropping tool.
Stars: ✭ 35 (+169.23%)
Mutual labels:  responsive-images
guide-to-async-components
📖 Guide To JavaScript Async Components
Stars: ✭ 79 (+507.69%)
Mutual labels:  responsive-images
responsive-images
Generate responsive images to work with the srcset and sizes spec
Stars: ✭ 53 (+307.69%)
Mutual labels:  responsive-images
Timmy
Advanced image handling for Timber.
Stars: ✭ 146 (+1023.08%)
Mutual labels:  responsive-images
acf-image-aspect-ratio-crop
Image Aspect Ratio Crop field for Advanced Custom Fields
Stars: ✭ 100 (+669.23%)
Mutual labels:  responsive-images
axiom
Axiom - A Hugo Theme. GitTip: https://gitcoin.co/tip?username=jhauraw
Stars: ✭ 67 (+415.38%)
Mutual labels:  responsive-images
Vanilla Lazyload
LazyLoad is a lightweight, flexible script that speeds up your website by deferring the loading of your below-the-fold images, backgrounds, videos, iframes and scripts to when they will enter the viewport. Written in plain "vanilla" JavaScript, it leverages IntersectionObserver, supports responsive images and enables native lazy loading.
Stars: ✭ 6,596 (+50638.46%)
Mutual labels:  responsive-images
srcset.sh
A command line script that generates multiple responsive versions of an image at width breakpoints -- 320,480,640,768,960,1024,1280,1440 pixels wide -- that match common Mobile and widescreen desktop/laptop viewports using Imagemagick's convert utility and outputs the needed <img/> tag
Stars: ✭ 20 (+53.85%)
Mutual labels:  responsive-images
just-responsive-images
WordPress Plugin to support better responsive images with <picture> tag, backgrounds, retina support etc.
Stars: ✭ 47 (+261.54%)
Mutual labels:  responsive-images
ember-responsive-image
Automatically generate resized images at build-time, optimized for the responsive web, and using components to render them easily as <picture> elements.
Stars: ✭ 103 (+692.31%)
Mutual labels:  responsive-images
Twelvety
An Eleventy starter project built to be fast
Stars: ✭ 195 (+1400%)
Mutual labels:  responsive-images
Lazysizes
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.
Stars: ✭ 15,716 (+120792.31%)
Mutual labels:  responsive-images
qis
Dynamic image server for web and print
Stars: ✭ 85 (+553.85%)
Mutual labels:  responsive-images
Enfasten
⚡️ Automatically make your site faster with optimized responsive images
Stars: ✭ 56 (+330.77%)
Mutual labels:  responsive-images
components
A Web component library that brings the power of TwicPics to your favorite web framework.
Stars: ✭ 21 (+61.54%)
Mutual labels:  responsive-images
React Simple Img
🌅 React lazy load images with IntersectionObserver API and Priority Hints
Stars: ✭ 905 (+6861.54%)
Mutual labels:  responsive-images
angular-image-loader
A simple progressive, responsive, lazy image and video loading library for Angular that detects browser size and loads the appropriate image or video only when the element is in viewport. This package requires @thisissoon/angular-inviewport
Stars: ✭ 21 (+61.54%)
Mutual labels:  responsive-images
Sitegeist.Kaleidoscope
Responsive Images for Neos CMS
Stars: ✭ 27 (+107.69%)
Mutual labels:  responsive-images
converjon
An advanced image conversion server and command line tool.
Stars: ✭ 52 (+300%)
Mutual labels:  responsive-images
gregives.co.uk
Personal site and portfolio of software engineer Greg Ives
Stars: ✭ 43 (+230.77%)
Mutual labels:  responsive-images

Respify

Respify responsive image library

A simple responsive images library, which parses a image from a set of child span nodes with data-media and data-src attributes. It uses media queries to select images.

Example

This is an example of how to use Respify. You can view a working example on the example page

Respify can either be used on an image tag, or any other tag but then the background option should be set to true. Respify wil pop from the array of span child nodes, this means that the last node in the list will be parsed first. If Respify finds one matching media query it will use the corresponding image and stop the search.

<span id="default-responsive" class="responsive-img" data-alt="This is an example of a responsive image">
	<span data-src="img/[email protected]" data-media="(max-width: 30em)"></span>
	<span data-src="img/[email protected]" data-media="(min-width: 30em) and (max-width: 48em)"></span>
	<span data-src="img/[email protected]" data-media="(min-width: 48em) and (max-width: 60em)"></span>
	<span data-src="img/[email protected]" data-media="(min-width: 60em) and (max-width: 80em)"></span>
	<span data-src="img/[email protected]" data-media="(min-width: 80em)"></span>

	<noscript><img src="ext/img/[email protected]" alt="A yacht race"></noscript>
</span>

Set up the Javascript like this:

$('#responsive').respify();

Respify is a spin off from the picture tag specification, the major difference is that it can set background image of the parent tag. Using child span tags you can supply different size images. Set the data-media tag to specify a media query and use the data-src tag to specify a src image.

Pass options to respify as an object:

$('img').respify({
	background : true
});

Respify adds an event listener to the resize event and will recalculate the image it has to use.

Options

background

type: boolean, default: false

wether to place the selected image as a background-image css property or as a img src attribute.

dryRun

type: boolean, default: false

If set to true the plugin will only return the set of matched images and not actually place them on the tags. This can be usefull if you want to supply the selected image to some other piece of code which can not implicitly handle responsive images.

callback

type: Function, default: undefined

Here you can supply a function to Respify, this function will be called whenever a new image is calculted at resize. This is especially usefull in combination with the dryRun setting where the image is not actually set on the picture tag.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].