1.0.0 • Published 5 years ago

responsive-image-gallery-react v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Responsive Image Gallery React

React integration for Responsive Image Gallery.

NPM

npm install --save-dev responsive-image-gallery-react

Yarn

yarn add responsive-image-gallery-react --dev

Installation

import React from 'react';
import * as RIG from 'responsive-image-gallery-react';

export default class App extends React.Component {
    render() {
        return(
            <div>
                <ul id="bar">
                    <li category="*" className="rig-active">All</li>
                    <li category="a">A</li>
                    <li category="b">B</li>
                    <li category="c">C</li>
                </ul>
                <RIG.Gallery bar="#bar">
                    <RIG.Element category="A">
                        <img src="img1.jpg" />
                    </RIG.Element>
                    <RIG.Element category="B">
                        <img src="img2.jpg" />
                    </RIG.Element>
                    <RIG.Element category="C">
                        <img src="img3.jpg" />
                    </RIG.Element>
                    <RIG.Element category="A">
                        <img src="img4.jpg" />
                    </RIG.Element>
                    <RIG.Element category="B">
                        <img src="img5.jpg" />
                    </RIG.Element>
                </RIG.Gallery>
            </div>
        )
    }
}

Configuration

Options

OptionTypeDefaultDescription
barstring | HTMLElement*nullBar element.
activestring“*”Specifies the initial active category.
timingstring“ease”Specifies the speed curve of an animation. Takes all the values CSS3 can take. (like ease, linear, cubic-bezier, step)
durationnumber500Defines how long an animation should take to complete one cycle. (as milliseconds)
minWidthnumber250Specifies the minimum width of a gallery element.
maxWidthnumber500Specifies the maximum width of a gallery element.
heightnumber80Sets the height according to the width. (as percent)
horizontalSpacenumber10Specifies the horizontal space between gallery elements.
verticalSpacenumber10Specifies the vertical space between gallery elements.
overflowbooleanfalseAllows elements to overflow if the container element's width is smaller than minWidth.
gridbooleantrueEnables grid view.

*: You can give an HTML element or a CSS selector (like #gallery, .container > div:first-child)

Methods

MethodParamsReturnDescription
getstringReturns the active category.
setcategory: string, animate: booleanvoidSets the active category.
getTimingstringReturns timing value.
setTimingtiming:stringvoidSets timing value.
getDurationnumberReturns duration.
setDurationduration:numbervoidSets duration.
destroyvoidDestroys the gallery.

IE Support

IE 10 is not supported and patches to fix problems will not be accepted.

License

Responsive Image Gallery React is provided under the MIT License.