You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-17Lines changed: 24 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,14 @@
1
1
# react-card-scroll
2
2
A React component to horizontally navigate between components of same width (Bootstrap cards for example).
3
-
It is responsive and support card adds and removes.
3
+
It is responsive and support dynamic card adds and removes.
4
4
5
+
You decide how many cards will be simultaneously visible depending on screen size, in the bootstrap style. You can then navigate to the other cards depending on how you want to implement it. If you don't want to implement anything, you can use default arrows.
5
6
6
-
For example you can have 3 cards on the screen and there is a total of 5 cards, you can navigate right or left to the cards not displayed.
7
-
You resize and you display only 2 cards, you can still navigate to the other cards.
7
+
Visually you have a left stack of cards, visible cards in the middle, and a right stack.
8
8
9
-
Navigation can also be triggered programmatically.
10
-
11
-
## New in 1.x
12
-
No need to give card width and card count anymore
9
+
## New in 2.x
10
+
Using stacks instead of sliding cards out of the screen
Import css either in sass ```~react-card-scroll/lib/assets/styles.css``` or in javascript with webpack
21
+
22
+
Use bootstrap style to decide how many cards will be visible (just add ```rcs-```): ```rcs-col-*-*```. You don't have to include bootstrap.
23
+
24
+
Choose how you want to implement the navigation by using ```scrollCards({toLeft: true/false, number:*})```.For example, you can scroll when you click on a stack or when you wheel your mouse with the pointer on a card title.
25
+
See the example: ```npm run example``` and open localhost:8081. And get inspiration from the source code.
22
26
27
+
You can know where a card is with the ```getCardOffset``` function in JavaScript, or with the CSS classes ```rcs-left-stack rcs-center rcs-right-stack```
23
28
29
+
Use arrows with props ```showArrows={true}```
30
+
31
+
## Some (very) basic usage
24
32
```jsx
25
33
<CardScroll ref="cardScroll">
26
-
<div className="col-sm-6 col-md-4">
34
+
<div className="rcs-col-sm-6 rcs-col-md-4">
27
35
</div>
28
36
29
-
<div className="col-sm-6 col-md-4">
37
+
<div className="rcs-col-sm-6 rcs-col-md-4">
30
38
</div>
31
39
32
-
<div className="col-sm-6 col-md-4">
40
+
<div className="rcs-col-sm-6 rcs-col-md-4">
33
41
</div>
34
42
35
-
<div className="col-sm-6 col-md-4">
43
+
<div className="rcs-col-sm-6 rcs-col-md-4">
36
44
</div>
37
45
38
-
<div className="col-sm-6 col-md-4">
46
+
<div className="rcs-col-sm-6 rcs-col-md-4">
39
47
</div>
40
48
</CardScroll>
41
49
```
@@ -46,15 +54,14 @@ From parent, trigger navigation when you want (add or remove cards, click somewh
0 commit comments