I have a question concerning snapping-points in CSS (resource, browser-support). I want to scroll completely normal throughout the body until a latter "hidden" section. When the user scrolls to the bottom of the second last section the viewport should snap with the bottom to the bottom of this section (same as the top of the last section). When the user tries to scroll through this one snap it should be only possible by overcoming a specific threshold.
I have visualized my issue for better understanding, I deeply hope this is possible with the current specification of snapping-points.
CSS Scroll Snap is a module of CSS that introduces scroll snap positions, which enforce the scroll positions that a scroll container's scrollport may end at after a scrolling operation has completed.
CSS Demo: scroll-padding This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars), or to put more breathing room between a targeted element and the edges of the scrollport.
CSS Scroll Snap is supported in all major browsers. A previous version of the specification was implemented in some browsers, and may appear in tutorials and articles. If material includes the deprecated scroll-snap-points-x and scroll-snap-points-y properties, it should be considered outdated.
This is as far as I could get it using Alvaro Trigo's nice library pagePiling:
http://codepen.io/anon/pen/NxaeZm
The content is organized like so:
<div id="pagepiling">
<div class="section pp-scrollable" id="section1">
<p>Content that scrolls normally</p>
</div>
<div class="section" id="hidden">
<p>Not scrollable</p>
</div>
<div class="section pp-scrollable" id="section2">
<p>Content that scrolls normally again</p>
</div>
</div>
The middle section hijacks the scrolling, and afterwards you can continue scrolling towards the second section, which scrolls like a normal page again. I haven't been able to add a threshold to access the middle section. I leave it up to you there. Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With