All Projects → estrattonbailey → relaze

estrattonbailey / relaze

Licence: other
Tiny image lazy loading library for React.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to relaze

Accessible Image Lazy Load
😴 gandul! accessible lazy loading images
Stars: ✭ 281 (+1305%)
Mutual labels:  lazy, lazy-loading
jekyll-loading-lazy
🧙🏽‍♀️ Automatically adds loading="lazy" to <img> and <iframe> tags. Load images on your sites lazily without JavaScript.
Stars: ✭ 41 (+105%)
Mutual labels:  lazy, lazy-loading
Pimg
📷 Mini Image Lazy Loader for P(R)eact and Vue
Stars: ✭ 97 (+385%)
Mutual labels:  lazy, lazy-loading
lazyImages
基于ES6的轻量级,高性能,简便的图片懒加载 🐈
Stars: ✭ 43 (+115%)
Mutual labels:  lazy, lazy-loading
Jquery.lazy
A lightweight, fast, feature-rich, powerful and highly configurable delayed content, image and background lazy loading plugin for jQuery & Zepto.
Stars: ✭ 965 (+4725%)
Mutual labels:  lazy, lazy-loading
Responsively Lazy
Lazy load responsive images
Stars: ✭ 1,080 (+5300%)
Mutual labels:  lazy, lazy-loading
lazy-load-images.js
Progressive & lazy loading images.
Stars: ✭ 17 (-15%)
Mutual labels:  lazy, lazy-loading
Itiriri
A library built for ES6 iteration protocol.
Stars: ✭ 155 (+675%)
Mutual labels:  lazy
generator-angular-lazy
Yeoman generator for creating Angular applications which lazy load components as needed at runtime. Based on SystemJS, JSPM, Babel and Gulp.
Stars: ✭ 33 (+65%)
Mutual labels:  lazy-loading
Lazy Rdp
Script for automatic scanning & brute-force RDP
Stars: ✭ 118 (+490%)
Mutual labels:  lazy
Lazy Compile Webpack Plugin
Boost webpack startup time by lazily compiling dynamic imports
Stars: ✭ 106 (+430%)
Mutual labels:  lazy
Hitchcock
The Master of Suspense 🍿
Stars: ✭ 167 (+735%)
Mutual labels:  lazy
laravelmanthra
Laravel Crud Generator, I have working for years and I can tell you... It's all CRUD 💩💩💩
Stars: ✭ 27 (+35%)
Mutual labels:  lazy
Lazy Collections
Collection of fast and lazy operations
Stars: ✭ 146 (+630%)
Mutual labels:  lazy
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 (+5%)
Mutual labels:  lazy-loading
Lazyhub
lazyhub - Terminal UI Client for GitHub using gocui.
Stars: ✭ 133 (+565%)
Mutual labels:  lazy
react-component-transition
Easy animations between react component transitions.
Stars: ✭ 20 (+0%)
Mutual labels:  lazy
nvim-config
My neovim config
Stars: ✭ 63 (+215%)
Mutual labels:  lazy
vitext
The Next.js like React framework for better User & Developer experience!
Stars: ✭ 376 (+1780%)
Mutual labels:  lazy-loading
lazy-kit
A new design system for developing with less effort. See how it looks:
Stars: ✭ 68 (+240%)
Mutual labels:  lazy

relaze

Tiny image lazy loading library for React. 800 bytes gzipped.

Features

  1. Single higher-order component
  2. Performant scrolling using requestAnimationFrame
  3. Supports srcset
  4. Universal

Install

npm i relaze --save

Usage

Create a reusable image component:

// Image.js
import relaze from 'relaze'

export default relaze(({ src, srcSet }) => (
  <img src={src} srcSet={srcSet} />
))

Pass it a src and a srcSet prop (optional):

import Image from './Image.js'

<Image src='image.jpg' srcSet='image.jpg 600w, image-large.jpg 1200w' />

When the image enters the viewport, Relaze will pass the src and srcSet props to its child component.

Fade-in Image

// Image.js
import relaze from 'relaze'
import cx from 'classnames'

class Image extends React.Component {
  constructor(props) {
    super(props)
    this.state = { loaded: false }
  }

  render() {
    const { loaded } = this.state
    const { src, srcSet } = this.props

    return (
      <img
        src={src}
        srcSet={srcSet}
        className={cx({
          'is-loaded': loaded
        })}
        onLoad={e => {
          this.setState({
            loaded: true
          })
        }} />
    )
  }
}

export default relaze(Image)

Background Image

import relaze from 'relaze'

export default relaze(({ src }) => (
  <div style={{
    backgroundImage: `url(${src})`
  }} />
))

Adjusting Threshold

A fraction of the viewport height. Positive values makes image load sooner, negative values makes image load later.

import Image from './Image.js'

<Image src='image.jpg' threshold={0.2} />

License

MIT License © Eric Bailey

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