Skip to content

Commit a5b81bc

Browse files
committed
feat : add props transitionDuration
1 parent 34525c2 commit a5b81bc

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

package/src/ReactFullpage.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ html.react-fullpage__html *:has(.react-fullpage__wrapper) {
5252
position: relative;
5353
width: 100%;
5454
height: 100%;
55-
transition: transform 700ms;
55+
transition-property: transform;
5656
}
5757
.react-fullpage__scrollbar {
5858
position: absolute;

package/src/components/FullpageContainer.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ import usePrevious from '../hooks/usePrevious';
77

88
interface IProps {
99
children: React.ReactNode;
10-
activeIndex: number;
10+
activeIndex: number; // 현재 활성화 Section의 Index
1111
setActiveIndex: (afterIndex: number) => void;
12+
transitionDuration?: number; // Section 전환 속도
1213
onBeforeChange?: (beforeIndex: number, afterIndex: number) => void;
1314
onAfterChange?: (beforeIndex: number, afterIndex: number) => void;
1415
}
1516

1617
function FullpageContainer({
1718
children,
1819
activeIndex,
20+
transitionDuration = 700,
1921
setActiveIndex,
2022
onBeforeChange,
2123
onAfterChange,
@@ -101,6 +103,7 @@ function FullpageContainer({
101103
className="react-fullpage__container"
102104
style={{
103105
transform: `translate3d(0px, -${transformY}px, 0px)`,
106+
transitionDuration: `${transitionDuration}ms`,
104107
}}
105108
ref={container}
106109
data-is-animating={isAnimating}

test/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function App() {
1414
return (
1515
<>
1616
<FullpageContainer
17+
transitionDuration={700}
1718
activeIndex={activeIndex}
1819
setActiveIndex={setActiveIndex}
1920
onBeforeChange={(beforeIndex, afterIndex) => {

0 commit comments

Comments
 (0)