A JavaScript plugin that, after scrolling, snaps to blocks of content which I like to call panels. You can actually nest sets of panels as you will see throughout this demo page.
Each following panel will explain a specific feature of the PanelSnap plugin.
<!doctype html> <html> <head> <script src="/path/to/panelsnap.js" defer></script> <script> document.addEventListener("DOMContentLoaded", function() { new PanelSnap(); }); </script> </head> <body> <section> ... </section> <section> ... </section> <section> ... </section> </body> </html>
<script> var defaultOptions = { container: document.body, panelSelector: '> section', directionThreshold: 50, delay: 0, duration: 300, easing: function(t) { return t }, }; new PanelSnap(options); </script>
When a panel is larger than the viewport, PanelSnap will snap to the top of a panel when scrolling down, and snap to it's bottom when scrolling up.