Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container inside react component #138

Closed
BKengagement opened this issue Sep 13, 2018 · 11 comments
Closed

Container inside react component #138

BKengagement opened this issue Sep 13, 2018 · 11 comments

Comments

@BKengagement
Copy link

I am having a hard time with the container option. Could you please assist in helping me create a container? Not all my section will need to have a snap option.

componentDidMount() {
const node = ReactDOM.findDOMNode(this);
this.panelSnapInstance = new PanelSnap({
container: node,
panelSelector: '.panel'
});
}

@guidobouman
Copy link
Owner

Is your DOM node a scrolling div?

@BKengagement
Copy link
Author

Yes I have the overflow as scroll. I am not getting any errors so it is finding the container. The scroll logic just doesn't work.

@BKengagement
Copy link
Author

Ok, I got it to work with overflow:auto, and container height 100vh. The problem now is there are 2 scrollbars. I am trying to achieve something like this. https://ueno.co/careers#new-york-city

@guidobouman
Copy link
Owner

I really like that idea!

Do you have a demo page I can look at?

@BKengagement
Copy link
Author

@guidobouman
Copy link
Owner

guidobouman commented Sep 17, 2018

That's a bit of a small demo. Anything with your code in there already? Do you have content before or after the panels like the inspiration page you shared?

@BKengagement
Copy link
Author

https://yjo5y0mvlx.codesandbox.io/

If I set the container to document.body the snap functionality only works until all sections leave the screen. It then says no snapable sections found.

If I set the container to a specific div and make it scrollable then there are 2 scrollbars that cause problems as you can see in the demo.

@BKengagement
Copy link
Author

So is in not possible to have non snap-able section when the container is the body? Could really use your help...

@BKengagement
Copy link
Author

All good, just had to rework your code. thx

@guidobouman
Copy link
Owner

Just wondering: what did you change? Changing the internals of a library is usually not a great idea. But is this something that should be in the library by default?

@guidobouman
Copy link
Owner

guidobouman commented Sep 27, 2018

Ah, I see your case: you want to be able to scroll freely when there are no containers in the viewport.

Would adding an option to tell the plugin wether to force a snap or only snap when a panel is visible work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants