Giter Site home page Giter Site logo

afeiship / react-fade-image Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 458 KB

Fade or lazy image for react.

License: MIT License

JavaScript 72.65% HTML 9.49% Ruby 8.76% SCSS 9.10%
react fade fade-in image img lazy fade-out component components widget

react-fade-image's Introduction

react-fade-image

Fade or lazy image for react.

version license size download

installation

npm install -S @jswork/react-fade-image

properties

Name Type Required Default Description
className string false - The extended className for component.
lazy bool false false If set lazy load mode.
once bool false false Lazy only once.
onChange func false noop The change handler.

usage

  1. import css
@import "~@jswork/react-fade-image/dist/style.css";

// or use sass
@import "~@jswork/react-fade-image/dist/style.scss";

// customize your styles:
$react-fade-image-options: ()
  1. import js
import ReactDemokit from '@jswork/react-demokit';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactFadeImage from '@jswork/react-fade-image';
import './assets/style.scss';

class App extends React.Component {
  state = {
    lazyValue: true
  };

  handleClick = () => {
    this.setState({ lazyValue: false });
  };

  render() {
    const { lazyValue } = this.state;
    return (
      <ReactDemokit
        className="p-3 app-container"
        url="https://github.com/afeiship/react-fade-image">
        <p className="text-center">
          <button className="button is-large is-fullwidth is-primary" onClick={this.handleClick}>
            Trigger Load Image
          </button>
        </p>
        <div className="list">
          <p>
            <ReactFadeImage src="https://imglf4.nosdn.127.net/img/KzNuMlRKSFVENitYYjJBYnU5Q2cwQjRjd0ljSURUWmxZeGxvWVlOYnhHZWRReFBoUVJWUXFRPT0.jpg?imageView&thumbnail=1680x0&quality=96&stripmeta=0&type=jpg" />
          </p>
          <p>
            <ReactFadeImage
              lazy={lazyValue}
              src="https://imglf6.nosdn.127.net/img/ZWl4dnBUa0VLMzhXRThRbnV3UWlQelY1dGNPeUdQMUhib2IwOEVvTEhvUTRISnUwNmkwekV3PT0.jpg?imageView&thumbnail=3000y2000&type=jpg&quality=96&stripmeta=0&type=jpg%7Cwatermark&type=2&text=wqkgeHVlc2h1wrdBcnRvbW8gLyA3NzQzNzQ2NTUubG9mdGVyLmNvbQ==&font=bXN5aA==&gravity=southwest&dissolve=30&fontsize=680&dx=32&dy=36&stripmeta=0"
            />
          </p>
          <p>
            <ReactFadeImage
              lazy={lazyValue}
              src="http://imglf5.nosdn.127.net/img/K0FrVGtpUSszZU1kODV6SzZUSFZaNFhGaEliU29uSmJzL3lXdUpoK3ZLdjMyNWp1OWJTRnB3PT0.jpg?imageView&thumbnail=3000y1687&type=jpg&quality=96&stripmeta=0&type=jpg"
            />
          </p>
        </div>
      </ReactDemokit>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('app'));

documentation

license

Code released under the MIT license.

react-fade-image's People

Contributors

afeiship avatar

Watchers

 avatar  avatar  avatar

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.