A JavaScript plugin that, after scrolling, snaps to blocks of content which I like to call panels. It's API makes the plugin easy to tailor to the needs of your project.
Each of the following panels will explain a specific aspect 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>
Common usecases are explained through a set of demos.
These demos can also be found on GitHub.