Skip to content

Commit

Permalink
Merge pull request #97 from femioladeji/touch-scroll
Browse files Browse the repository at this point in the history
support touch and drag event
  • Loading branch information
femioladeji authored Aug 20, 2020
2 parents 88d3fdc + 0851291 commit 20ab1cd
Show file tree
Hide file tree
Showing 16 changed files with 179 additions and 72 deletions.
9 changes: 8 additions & 1 deletion docs/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,19 @@ h3 {

.each-fade {
display: flex;
width: 100%;
}

.each-fade img {
.each-fade > div {
width: 75%;
}

.each-fade > div img {
width: 100%;
height: 100%;
object-fit: cover;
}

.each-fade p {
width: 25%;
font-size: 1em;
Expand Down
57 changes: 42 additions & 15 deletions docs/views/codeStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,22 @@ const FadeExample = () => {
<div className="slide-container">
<Fade>
<div className="each-fade">
<img src={fadeImages[0]} />
<h2>First Slide</h2>
<div>
<img src={fadeImages[0]} />
</div>
<p>First Slide</p>
</div>
<div className="each-fade">
<h2>Second Slide</h2>
<img src={fadeImages[1]} />
<p>Second Slide</p>
<div>
<img src={fadeImages[1]} />
</div>
</div>
<div className="each-fade">
<img src={fadeImages[2]} />
<h2>Third Slide</h2>
<div>
<img src={fadeImages[2]} />
</div>
<p>Third Slide</p>
</div>
</Fade>
</div>
Expand All @@ -135,12 +141,19 @@ export default FadeExample;
export const fadeEffectCSS = `
.each-fade {
display: flex;
width: 100%;
}
.each-fade img {
.each-fade > div {
width: 75%;
}
.each-fade > div img {
width: 100%;
height: 100%;
object-fit: cover;
}
.each-fade p {
width: 25%;
font-size: 1em;
Expand Down Expand Up @@ -171,7 +184,11 @@ const Slideshow = () => {
return (
<div>
<Zoom {...zoomInProperties}>
{ images.map((each, index) => <img key={index} style={{width: "100%"}} src={each} />) }
{images.map((each, index) => (
<div key={index} style={{width: "100%"}}>
<img style={{ objectFit: "cover", width: "100%" }} src={each} />
</div>
))}
</Zoom>
</div>
)
Expand All @@ -198,7 +215,11 @@ const Slideshow = () => {
return (
<div>
<Zoom {...zoomOutProperties}>
{ images.map((each, index) => <img key={index} style={{width: "100%"}} src={each} />) }
{images.map((each, index) => (
<div key={index} style={{width: "100%"}}>
<img style={{ objectFit: "cover", width: "100%" }} src={each} />
</div>
))}
</Zoom>
</div>
)
Expand Down Expand Up @@ -387,15 +408,21 @@ const PauseHoverExample = () => {
<div className="slide-container">
<Slide {...fadeProperties}>
<div className="each-fade">
<img src={images[0]} />
<div>
<img src={fadeImages[0]} />
</div>
<p>First Slide</p>
</div>
<div className="each-fade">
<p>Second Slide</p>
<img src={images[1]} />
<div>
<img src={fadeImages[1]} />
</div>
</div>
<div className="each-fade">
<img src={images[2]} />
<div>
<img src={fadeImages[2]} />
</div>
<p>Third Slide</p>
</div>
</Slide>
Expand All @@ -417,7 +444,7 @@ const AutoplayExample = () => {
const style = {
textAlign: "center",
background: "teal",
padding: "200px",
padding: "200px 0",
fontSize: "30px"
}
Expand Down Expand Up @@ -461,7 +488,7 @@ const MethodsExample = () => {
const style = {
textAlign: "center",
background: "teal",
padding: "200px",
padding: "200px 0",
fontSize: "30px"
};
Expand Down Expand Up @@ -525,7 +552,7 @@ const CallbackExample = () => {
const style = {
textAlign: "center",
padding: "200px",
padding: "200px 0",
fontSize: "30px"
};
Expand Down
2 changes: 1 addition & 1 deletion docs/views/pages/Examples/Autoplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const AutoplayExample = () => {
const style = {
textAlign: "center",
background: "teal",
padding: "200px",
padding: "200px 0",
fontSize: "30px"
}

Expand Down
2 changes: 1 addition & 1 deletion docs/views/pages/Examples/Callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const CallbackExample = () => {

const style = {
textAlign: "center",
padding: "200px",
padding: "200px 0",
fontSize: "30px"
};

Expand Down
4 changes: 3 additions & 1 deletion docs/views/pages/Examples/CustomIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ const CustomIndicatorExample = () => {
<div>
<Zoom {...zoomOutProperties}>
{images.map((each, index) => (
<img key={index} style={{ width: '100%' }} src={each} />
<div key={index} style={{width: "100%"}}>
<img style={{ objectFit: "cover", width: "100%" }} src={each} />
</div>
))}
</Zoom>
</div>
Expand Down
18 changes: 12 additions & 6 deletions docs/views/pages/Examples/Fade.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,22 @@ const FadeExample = () => {
<div>
<Fade {...fadeProperties}>
<div className="each-fade">
<img src={fadeImages[0]} />
<h2>First Slide</h2>
<div>
<img src={fadeImages[0]} />
</div>
<p>First Slide</p>
</div>
<div className="each-fade">
<h2>Second Slide</h2>
<img src={fadeImages[1]} />
<p>Second Slide</p>
<div>
<img src={fadeImages[1]} />
</div>
</div>
<div className="each-fade">
<img src={fadeImages[2]} />
<h2>Third Slide</h2>
<div>
<img src={fadeImages[2]} />
</div>
<p>Third Slide</p>
</div>
</Fade>
</div>
Expand Down
12 changes: 9 additions & 3 deletions docs/views/pages/Examples/PauseHover.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@ const PauseOnHoverExample = () => {
<div>
<Slide {...fadeProperties}>
<div className="each-fade">
<img src={fadeImages[0]} />
<div>
<img src={fadeImages[0]} />
</div>
<p>First Slide</p>
</div>
<div className="each-fade">
<p>Second Slide</p>
<img src={fadeImages[1]} />
<div>
<img src={fadeImages[1]} />
</div>
</div>
<div className="each-fade">
<img src={fadeImages[2]} />
<div>
<img src={fadeImages[2]} />
</div>
<p>Third Slide</p>
</div>
</Slide>
Expand Down
4 changes: 3 additions & 1 deletion docs/views/pages/Examples/Zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ const ZoomExample = () => {
<div>
<Zoom {...zoomInProperties}>
{images.map((each, index) => (
<img key={index} style={{ width: "100%" }} src={each} />
<div key={index} style={{width: "100%"}}>
<img style={{ objectFit: "cover", width: "100%" }} src={each} />
</div>
))}
</Zoom>
</div>
Expand Down
4 changes: 3 additions & 1 deletion docs/views/pages/Examples/ZoomOut.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ const ZoomExample = () => {
<div>
<Zoom {...zoomOutProperties}>
{images.map((each, index) => (
<img key={index} style={{ width: "100%" }} src={each} />
<div key={index} style={{width: "100%"}}>
<img style={{ objectFit: "cover", width: "100%" }} src={each} />
</div>
))}
</Zoom>
</div>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-slideshow-image",
"version": "3.0.2",
"version": "3.1.0",
"author": "Femi Oladeji",
"description": "An image slideshow with react",
"files": [
Expand Down
66 changes: 34 additions & 32 deletions src/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.react-slideshow-container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}

.react-slideshow-container .nav {
Expand All @@ -16,23 +20,15 @@
cursor: pointer;
color: #fff;
border-radius: 50%;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
align-items: center;
justify-content: center;
}

.react-slideshow-container .default-nav span {
display: block;
width: 10px;
height: 10px;
border-color: #000;
border-style: solid;
box-sizing: border-box;
transform: rotate(45deg);
}

.react-slideshow-container .default-nav.disabled span {
border-color: #666;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}

.react-slideshow-container .default-nav:hover,
Expand All @@ -52,26 +48,21 @@
border-top: none;
}

.react-slideshow-container .default-nav:first-of-type span {
margin-left: 5px;
border-right: none;
border-top: none;
}

.react-slideshow-container .default-nav:last-of-type {
margin-left: -30px;
}

.react-slideshow-container .default-nav:last-of-type span {
margin-right: 5px;
border-left: none;
border-bottom: none;
}

.react-slideshow-container + div.indicators {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
justify-content: center;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
margin-top: 20px;
}

Expand Down Expand Up @@ -117,8 +108,11 @@
}

.react-slideshow-fade-wrapper .react-slideshow-fade-images-wrap {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}

.react-slideshow-fade-wrapper .react-slideshow-fade-images-wrap > div {
Expand All @@ -132,8 +126,11 @@
}

.react-slideshow-wrapper .images-wrap {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}

.react-slideshow-zoom-wrapper {
Expand All @@ -142,12 +139,17 @@
}

.react-slideshow-zoom-wrapper .zoom-wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
overflow: hidden;
}

.react-slideshow-zoom-wrapper .zoom-wrapper > div {
position: relative;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
Loading

0 comments on commit 20ab1cd

Please sign in to comment.