-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathClassToggle.js
46 lines (40 loc) · 1 KB
/
ClassToggle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// @flow
import React from 'react';
import styled from 'styled-components';
import { Controller, Scene } from 'react-scrollmagic';
const ClassToggleStyled = styled.div`
.section {
height: 100vh;
}
.test {
transition: width 0.3s ease-out;
width: 100px;
height: 100px;
background-color: red;
margin: 0 !important;
&.yellow {
background-color: yellow;
}
}
.zap {
width: 100%;
}
`;
const ClassToggle = () => (
<ClassToggleStyled>
<div className="section" />
<div id="trigger" />
<Controller>
<Scene duration={200} classToggle="zap" triggerElement="#trigger" indicators={true}>
{(progress, event) => (
<div className="test">Pin Test {event.type} {progress}</div>
)}
</Scene>
<Scene classToggle={['.test', 'yellow']} reverse={false} indicators={true}>
<div>Toggle other class</div>
</Scene>
</Controller>
<div className="section" />
</ClassToggleStyled>
);
export default ClassToggle;