-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
93 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,30 @@ | ||
import React from 'react'; | ||
import ReactSwipes from 'react-swipes'; | ||
import { Link } from 'react-router-dom'; | ||
import './slider.pcss'; | ||
import Img from '../../../../../source/img/service/slider.png'; | ||
import React from 'react' | ||
import Slider from 'react-slick' | ||
import './slider.pcss' | ||
import img from '../../../../../source/img/service/slider.png' | ||
|
||
const items = [ | ||
{ img: Img, key: 0 }, | ||
{ img: Img, key: 1 }, | ||
{ img: Img, key: 2 }, | ||
]; | ||
// swipes 的配置 | ||
const opt = { | ||
// https://github.com/younth/react-swipes | ||
distance: document.body.clientWidth, | ||
}; | ||
|
||
function Slider() { | ||
export default function Sliders() { | ||
const settings = { | ||
accessibility: true, // 是否开启箭头 | ||
className: 'mySlider', | ||
adaptiveHeight: true, // 自动调整幻灯片高度 | ||
arrows: false, // 是否显示箭头导航 | ||
autoplay: true, | ||
autoplaySpeed: 2500, | ||
dots: true, // 导航点 | ||
infinite: true, | ||
speed: 500, | ||
slidesToShow: 1, | ||
slidesToScroll: 1 | ||
} | ||
return ( | ||
<div className="viewport"> | ||
<ReactSwipes className="card-slide" options={opt}> | ||
{ | ||
items.map(item => ( | ||
<div className="item" key={item.key}> | ||
<Link to="/"> | ||
<img src={item.img} alt="" /> | ||
</Link> | ||
</div> | ||
)) | ||
} | ||
</ReactSwipes> | ||
</div> | ||
); | ||
} | ||
|
||
export default Slider; | ||
<Slider id="slider" {...settings}> | ||
<div><img src={img} alt="" /></div> | ||
<div><img src={img} alt="" /></div> | ||
<div><img src={img} alt="" /></div> | ||
<div><img src={img} alt="" /></div> | ||
<div><img src={img} alt="" /></div> | ||
<div><img src={img} alt="" /></div> | ||
</Slider> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,11 @@ | ||
img { | ||
vertical-align: top; | ||
} | ||
.viewport { | ||
width: 300%; | ||
overflow: hidden; | ||
margin: 0 auto; | ||
-webkit-transform: translateZ(0); | ||
} | ||
|
||
.item { | ||
box-sizing: border-box; | ||
width: 750px; | ||
height: 370px; | ||
background: #EFEFEF; | ||
float: left; | ||
color: #666; | ||
.mySlider { | ||
position: relative; | ||
& img{ | ||
width: 100%; | ||
height: 100%; | ||
height: 400px; | ||
} | ||
} | ||
& .slick-dots{ | ||
position: absolute; | ||
bottom: 10px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters