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

Doesn't work for sections with height "200vh" #77

Closed
robpoole opened this issue Mar 19, 2015 · 11 comments
Closed

Doesn't work for sections with height "200vh" #77

robpoole opened this issue Mar 19, 2015 · 11 comments
Labels
Milestone

Comments

@robpoole
Copy link

When setting up a site with sections that are 2x the viewport height the plugin doesn't work. When scrolling to the first section the plugin kicks in and scrolls all the way to the bottom on the page.

@guidobouman
Copy link
Owner

What if you use a pixel height value?

And do you have a live testing url?

@gvdm
Copy link

gvdm commented Apr 15, 2015

I have the same issue, I think it is simply to do with uneven sized sections (with minimum size being equal to scrolling container, snap scrolling is unintuitive in situations where that is not true).

This seems to happen whenever any section is larger than the scrolling container. Ideally, the plugin would hold off snapping till the end of the section has been scrolled to. Furthermore, to aid identification of the bug, the plugin will keep snapping to the last section even when you try scrolling back up through sections. This is true of panelSnap 0.14.0 despite a similar issue #64 being closed.

Please see http://jsfiddle.net/pspp9veg/1/ for an example, the first snap is fine, thereafter problematic. Have a go.

@ynaveed
Copy link

ynaveed commented May 4, 2015

I have sorted down the problem to the function scrollStop. The childNumber exceeds the value of panelCount and therefore it scrolls to the bottom of the page. As stated above, this happens when the panels are short in height and of variable sizes. For me this particularly happens at around 700px height. I'll update when I have a solution

Update:
The actual reason turns out to be the scrollOffset being constant. As the panels have variable height (min-height: 100vh), thus they expand vertically on lower widths. The offset remains the same, thus the panel number exceeds the max-panels due to this calculation

  • childNumber = Math.round(offset / self.scrollInterval);
    Thus it snaps to the last panel.

@ynaveed
Copy link

ynaveed commented May 5, 2015

It's dirty solution, but I made to work. Instead of using the scroll offsets to judge which panel should it snap to, I used the given function getPanelsInView to get the panels. As their can be at max 2 panels in view (in my case at least), I keep a direction variable (up/down) and pass one of the panels for snapping.

@guidobouman
Copy link
Owner

That's actually quite smart @ynaveed! I'll take a look at it this this weekend.

@gvdm
Copy link

gvdm commented May 9, 2015

Would this also be related to the display breaking in a similar fashion when some sections are "display:none;"? Hopefully this fixes that too.

@gvdm
Copy link

gvdm commented May 17, 2015

@guidobouman any chance of this making it into some code I can look at and use?

@ynaveed for those of us who haven't gone into the code can you provide a branch with a commit/diff that I can view?

@theones
Copy link

theones commented May 21, 2015

@ynaveed ynaveed can you send some code of that ?

@ynaveed
Copy link

ynaveed commented May 21, 2015

@guidobouman
Copy link
Owner

You seem to have forgotten to push your changes to that branch.

@ynaveed
Copy link

ynaveed commented May 21, 2015

Oh yes, sorry for that. Please check now.

Regards,
Yasir

On Thu, May 21, 2015 at 5:54 PM, Guido Bouman notifications@github.com
wrote:

You seem to have forgotten to push your changes to that branch.


Reply to this email directly or view it on GitHub
#77 (comment)
.

@guidobouman guidobouman added this to the v0.15.0 milestone Jun 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants