Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react-image-lightbox npm

import React, { Component } from 'react';import Lightbox from 'react-image-lightbox';import 'react-image-lightbox/style.css'; // This only needs to be imported once in your app const images = [  '//placekitten.com/1500/500',  '//placekitten.com/4000/3000',  '//placekitten.com/800/1200',  '//placekitten.com/1500/1500',]; export default class LightboxExample extends Component {  constructor(props) {    super(props);     this.state = {      photoIndex: 0,      isOpen: false,    };  }   render() {    const { photoIndex, isOpen } = this.state;     return (      <div>        <button type="button" onClick={() => this.setState({ isOpen: true })}>          Open Lightbox        </button>         {isOpen && (          <Lightbox            mainSrc={images[photoIndex]}            nextSrc={images[(photoIndex + 1) % images.length]}            prevSrc={images[(photoIndex + images.length - 1) % images.length]}            onCloseRequest={() => this.setState({ isOpen: false })}            onMovePrevRequest={() =>              this.setState({                photoIndex: (photoIndex + images.length - 1) % images.length,              })            }            onMoveNextRequest={() =>              this.setState({                photoIndex: (photoIndex + 1) % images.length,              })            }          />        )}      </div>    );  }}
Comment

PREVIOUS NEXT
Code Example
Javascript :: deneme 
Javascript :: connection string in static class 
Javascript :: how to replace all words in javascript in hindi 
Javascript :: how to resolve click for div logging as parent too, in react 
Javascript :: how to send sendgrid email with dynamic template nodejs 
Javascript :: hoe to add variable to object in GDscribt 
Javascript :: progressbar jquery 3 ajax 
Javascript :: email id validation in javascript 
Javascript :: node red using tcp request 
Javascript :: Using Scrip as Web app 
Javascript :: javascript options documentation 
Javascript :: send email using javascript and mailtrap 
Javascript :: create component with COUNT 
Javascript :: discord.js change role permissions 
Javascript :: how to generate an onclose jest 
Javascript :: equals sign vue js 
Javascript :: javascript to typescript converter online 
Javascript :: node.js workflow template 
Javascript :: addingbackground image in nodejs 
Javascript :: Entendendo Package Json e instalando o Express 
Javascript :: Pause interval button javascript 
Javascript :: change bg props 
Javascript :: xslt 2 node text replace string 
Javascript :: react passport session 
Javascript :: organize api calls react native folder 
Javascript :: how to create hexadecimal encoded files in javascript 
Javascript :: next js global layout 
Javascript :: popover not working when next page datatable 
Javascript :: readonly checkbox angular 
Javascript :: date from = to 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =