-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated readme * Added detect top element while scrolling
- Loading branch information
Eward Somers
committed
May 28, 2018
1 parent
53f8193
commit 32d2a67
Showing
5 changed files
with
151 additions
and
28 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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { Component } from 'react'; | ||
import { ScrollContainer, ScrollSection, ScrollTo } from 'react-simple-scroll' | ||
|
||
class App extends Component { | ||
render() { | ||
return ( | ||
<div> | ||
<header> | ||
<h1>Example for using the module with the container id</h1> | ||
<button onClick={() => ScrollTo('section1', 'testContainer')}>Go to 1</button> | ||
<button onClick={() => ScrollTo('section5', 'testContainer')}>Go to 5</button> | ||
</header> | ||
<div> | ||
<ScrollContainer | ||
topScroll | ||
topScrollCallback={(id) => console.log(id, 'active id!')} | ||
extraStyle={{ height: '200px', backgroundColor: 'gray'}} | ||
containerId="testContainer" | ||
> | ||
<ScrollSection sectionId="section1"> | ||
<div style={{ height: '40px'}}>Section 1</div> | ||
</ScrollSection> | ||
<ScrollSection sectionId="section2"> | ||
<div style={{ height: '70px'}}>Section 2</div> | ||
</ScrollSection> | ||
<ScrollSection sectionId="section3"> | ||
<div style={{ height: '70px'}}>Section 3</div> | ||
</ScrollSection> | ||
<ScrollSection sectionId="section4"> | ||
<div style={{ height: '70px'}}>Section 4</div> | ||
</ScrollSection> | ||
<ScrollSection sectionId="section5"> | ||
<div style={{ height: '70px'}}>Section 5</div> | ||
</ScrollSection> | ||
<ScrollSection sectionId="section6"> | ||
<div style={{ height: '70px'}}>Section 6</div> | ||
</ScrollSection> | ||
</ScrollContainer> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default App; |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React, { Component } from 'react'; | ||
import { ScrollContainer, ScrollSection, ScrollTo } from 'react-simple-scroll' | ||
|
||
class App extends Component { | ||
render() { | ||
return ( | ||
<div> | ||
<header> | ||
<h1>Example for using the module without the container id</h1> | ||
<button onClick={() => ScrollTo('section1')}>Go to 1</button> | ||
<button onClick={() => ScrollTo('section5')}>Go to 5</button> | ||
</header> | ||
<div> | ||
<ScrollContainer | ||
extraStyle={{ height: '200px', backgroundColor: 'gray'}} | ||
> | ||
<ScrollSection sectionId="section1"> | ||
<div style={{ height: '40px'}}>Section 1</div> | ||
</ScrollSection> | ||
<ScrollSection sectionId="section2"> | ||
<div style={{ height: '70px'}}>Section 2</div> | ||
</ScrollSection> | ||
<ScrollSection sectionId="section3"> | ||
<div style={{ height: '70px'}}>Section 3</div> | ||
</ScrollSection> | ||
<ScrollSection sectionId="section4"> | ||
<div style={{ height: '70px'}}>Section 4</div> | ||
</ScrollSection> | ||
<ScrollSection sectionId="section5"> | ||
<div style={{ height: '70px'}}>Section 5</div> | ||
</ScrollSection> | ||
<ScrollSection sectionId="section6"> | ||
<div style={{ height: '70px'}}>Section 6</div> | ||
</ScrollSection> | ||
</ScrollContainer> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default App; |