{"id":5923,"date":"2021-05-31T02:00:00","date_gmt":"2021-05-31T00:00:00","guid":{"rendered":"https:\/\/alvarotrigo.com\/epa\/why-not-to-use-css-scroll-snap\/"},"modified":"2024-07-26T14:31:30","modified_gmt":"2024-07-26T12:31:30","slug":"why-not-to-use-css-scroll-snap","status":"publish","type":"post","link":"https:\/\/alvarotrigo.com\/blog\/why-not-to-use-css-scroll-snap\/","title":{"rendered":"Why Not to Use CSS Scroll Snap [The Hidden Truth]"},"content":{"rendered":"\n<p>As front end developers, we often get excited about some pretty niche things.<\/p>\n\n\n\n<p>Take scrolling for instance. Remember when <a href=\"https:\/\/alvarotrigo.com\/blog\/kinetic-scrolling\/\">scroll inertia<\/a> came along? We&#8217;d be excitedly flicking through websites shouting &#8220;Look! It has momentum! It has MOMENTUM!&#8221; And people are looking at us like:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" data-src=\"https:\/\/alvarotrigo.com\/blog\/assets\/imgs\/katt-williams-looking-confused.jpeg\" alt=\"Katt Williams looking confused\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" \/><\/figure>\n\n\n\n<p>Well, CSS scroll snap is the latest innovation in the fascinating world of website scrolling. The next stage in its character arc, if you will.<\/p>\n\n\n\n<p>Unlike scroll inertia, which loosens up the scroll movement, CSS scroll snap reins it in. It adds more control over where and how the scrollport moves, forcing it to &#8220;snap&#8221; into place at positions you specify (by the way &#8211; the scrollport is just the element with the scollbar on it &#8211; whether that&#8217;s the window as a whole or an element within it).<\/p>\n\n\n\n<p>It&#8217;s AMAZING &#8211; there&#8217;s so much you can do with it. But that said, it&#8217;s not a silver bullet. There are some use cases where it&#8217;s not the ideal tool for the job, some where it can&#8217;t do the job alone (and you&#8217;ll need additional CSS\/JS), and some cases where it&#8217;s actually best avoided. Here are a few such situations&#8230;<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"your-scroll-based-animations-might-stop-working\">Your scroll-based animations might stop working<\/h2>\n\n\n<p>If you are using third-party libraries to generate animations based on the scroll position, these might stop working. This also applies to CMSs or website builders, such as Webflow, Elementor, Wix, etc.<\/p>\n\n\n\n<p>It all depends on how you implement CSS scroll snaps and what are your restrictions.<\/p>\n\n\n\n<p>The root of the problem is that, when using a CSS Snaps in full-screen and applying it on any element <strong>that is not the <code>html<\/code> element<\/strong>, the scrolled position is no longer available in any of the following properties (as most scroll-based libraries expect):<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>document.documentElement.scrollTop<\/code><\/li>\n\n\n\n<li><code>window.pageYOffset<\/code><\/li>\n\n\n\n<li><code>document.documentElement.clientTop<\/code><\/li>\n<\/ul>\n\n\n\n<p>Instead, the value of the scroll position will now be on <code>document.body.scrollTop<\/code>.<\/p>\n\n\n\n<p>This is because the scrolling element is no longer the <code>window<\/code> or <code>documentElement<\/code>, but the container you chose for the snap scroll. It can be the <code>body<\/code> itself or any other wrapper around your sections.<\/p>\n\n\n\n<p>On top of that, the event listener on the <code>window<\/code> object won&#8217;t catch the <code>scroll<\/code> event anymore:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">\/*\n* Not capturing the event when CSS snaps is \n* applied on a container.\n*\/<\/span>\n<span class=\"hljs-built_in\">window<\/span>.addEventListener(<span class=\"hljs-string\">'scroll'<\/span>, onScroll);\n\n<span class=\"hljs-comment\">\/* \n* Capturing the event when CSS snaps is \n* applied on the body.\n*\/<\/span>\n<span class=\"hljs-built_in\">document<\/span>.body.addEventListener(<span class=\"hljs-string\">'scroll'<\/span>, onScroll);\n\n<span class=\"hljs-comment\">\/*\n* Capturing the event when CSS snaps is\n* applied on a wrapper.\n*\/<\/span>\n<span class=\"hljs-built_in\">document<\/span>.querySelector(<span class=\"hljs-string\">'.my-wrapper'<\/span>)\n  .addEventListener(<span class=\"hljs-string\">'scroll'<\/span>, onScroll);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>This can be a bit tricky and might generate unexpected conflicts with external libraries, website builders or even with your own code.<\/p>\n\n\n\n<p>Here&#8217;s a codepen illustrating the issue. Notice you won&#8217;t get any message on the JS console:<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_XWEwpja\" data-src=\"\/\/codepen.io\/anon\/embed\/XWEwpja?height=450&amp;theme-id=1&amp;slug-hash=XWEwpja&amp;default-tab=js,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed XWEwpja\" title=\"CodePen Embed XWEwpja\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"css-scroll-snap-doesn't-support-mouse-dragging-by-default\">CSS scroll snap doesn&#8217;t support mouse-dragging by default<\/h2>\n\n\n<p>CSS scroll snap is a modification of the browser&#8217;s normal scrolling behaviour &#8211; that&#8217;s it. This means that you&#8217;re not able &#8211; by default &#8211; to scroll through the content by clicking and dragging with your mouse.<\/p>\n\n\n\n<p>If you scroll with the scrollbar, mousewheel, or by clicking inside the element and using the direction keys, it works just fine. However, if you try to click and drag with your mouse, you won&#8217;t activate scrolling &#8211; you&#8217;ll just select the text or other elements nearby as normal.<\/p>\n\n\n\n<p>Try it below and see. For your enjoyment, I have written the content of these slides in Haiku format:<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_gOmoazo\" data-src=\"\/\/codepen.io\/anon\/embed\/gOmoazo?height=450&amp;theme-id=1&amp;slug-hash=gOmoazo&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed gOmoazo\" title=\"CodePen Embed gOmoazo\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p>So why should you care about this? Well, a key part of usability is making your site work in the way that people <em>expect<\/em> it to work. &#8220;<em>Don&#8217;t make me think<\/em>,&#8221; as Steve Krug would say.<\/p>\n\n\n\n<p>And because we&#8217;re all so used to touchscreen devices these days, it&#8217;s natural for people to try to replicate that type of interaction when using a normal desktop or laptop machine.<\/p>\n\n\n\n<p>That means, if you&#8217;ve got a <a href=\"https:\/\/alvarotrigo.com\/blog\/javascript-slider-how-to-make-one\/\">slider<\/a>, you can be sure that <em>some<\/em> people will try to click and drag it. So if your slider doesn&#8217;t support this, you may not be providing the optimal user experience for those users.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"problems-using-css-scroll-snap-when-your-content-is-larger-than-the-scrollport\">Problems using CSS scroll snap when your content is larger than the scrollport<\/h2>\n\n\n<p>You might think &#8220;Ahh, wouldn&#8217;t it be cool to add scroll snap to different sections of a page&#8230; maybe the headers in an article.&#8221;<\/p>\n\n\n\n<p>I like your idea &#8211; that way, people can scroll, and snap straight to the next section in the content. Wouldn&#8217;t that be convenient?<\/p>\n\n\n\n<p>Maybe not&#8230; if your sections are larger than the scrollport, your users will have trouble seeing all of your content. For example, take a setup like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.scrollport<\/span> {\n  <span class=\"hljs-attribute\">padding<\/span>: <span class=\"hljs-number\">20px<\/span>;\n  <span class=\"hljs-attribute\">height<\/span>: <span class=\"hljs-number\">500px<\/span>;\n  <span class=\"hljs-attribute\">overflow-y<\/span>: scroll;\n  <span class=\"hljs-attribute\">scroll-snap-type<\/span>: y mandatory;\n}\n\n<span class=\"hljs-selector-class\">.scrollport<\/span> <span class=\"hljs-selector-tag\">h2<\/span> {\n  <span class=\"hljs-attribute\">scroll-snap-align<\/span>: start;\n  <span class=\"hljs-attribute\">padding-top<\/span>: <span class=\"hljs-number\">10px<\/span>;\n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Here we&#8217;ve got a scrollport height of 500px, and we&#8217;re snapping to any <code>h2<\/code> element within the scrollport. But if the content under that <code>h2<\/code> is longer than 500px, we&#8217;ll end up with this:<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_QWpajxz\" data-src=\"\/\/codepen.io\/anon\/embed\/QWpajxz?height=450&amp;theme-id=1&amp;slug-hash=QWpajxz&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed QWpajxz\" title=\"CodePen Embed QWpajxz\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p>If you scroll down a little to read the content, the browser will snap you to the next <code>h2<\/code> in the <code>scrollport<\/code> element! (note that the filler text here comes from <a href=\"https:\/\/jeffsum.com\/\" target=\"_blank\" rel=\"noopener nofollow\">JeffSum.com<\/a>. It&#8217;s like Lorem Ipsum but with Jeff Goldblum quotes &#8211; and therefore much cooler).<\/p>\n\n\n\n<p>One thing you can do here is set <code>scroll-style-type<\/code> to <code>proximity<\/code> instead of <code>mandatory<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.scrollport<\/span> {\n  <span class=\"hljs-attribute\">padding<\/span>: <span class=\"hljs-number\">20px<\/span>;\n  <span class=\"hljs-attribute\">height<\/span>: <span class=\"hljs-number\">500px<\/span>;\n  <span class=\"hljs-attribute\">overflow-y<\/span>: scroll;\n  <span class=\"hljs-attribute\">scroll-snap-type<\/span>: y proximity;\n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>When we use <code>mandatory<\/code>, the browser will <em>always<\/em> snap to the next element when you start scrolling (like the example above). With <code>proximity<\/code>, it will only snap to an element if you are close to it, like this:<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_eYvypjO\" data-src=\"\/\/codepen.io\/anon\/embed\/eYvypjO?height=450&amp;theme-id=1&amp;slug-hash=eYvypjO&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed eYvypjO\" title=\"CodePen Embed eYvypjO\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p>In this case, because <code>scroll-snap-align<\/code> is set to <code>start<\/code>, the browser will snap to a <code>h2<\/code> if the <em>top<\/em> of the scrollport is close to it. Unfortunately at this time we can&#8217;t control exactly <em>how<\/em> close it needs to be for it to snap &#8211; that&#8217;s determined by the browser.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"snap-to-non-full-screen-sections-will-cause-issues\">Snap to non full-screen sections will cause issues<\/h2>\n\n\n<p>CSS scroll snap can do the trick when working with full-screen sections. However, when you want to work with non-fullscreen sections you will find some obvious problems.<\/p>\n\n\n\n<p>You might not be able to snap to the section you want and you&#8217;ll feel like you&#8217;ve lost control over the page scrolling.<\/p>\n\n\n\n<p>Here I demonstrate how I want to snap to section 2 when scrolling down and it goes back to section 1 unless section 2 is above the middle of the screen.<\/p>\n\n\n\n<p>Also, when I place myself in section 3, it&#8217;s literally impossible to snap to section 2.<\/p>\n\n\n\n<p>\n\t\t\t<a href=\"https:\/\/codepen.io\/alvarotrigo\/pen\/bGLGZZG\" target=\"_blank\" rel=\"noopener nofollow\">\n\t\t\t\t<video width=\"680\" height=\"382\" muted autoplay loop playsinline>\n\t\t\t\t<source src=\"https:\/\/cdn.jsdelivr.net\/gh\/alvarotrigo\/blog-assets\/videos\/css-snaps\/not-use-css-snaps-small-sections.webm\" type=\"video\/webm\"\/>\n\t\t\t\t<source src=\"https:\/\/cdn.jsdelivr.net\/gh\/alvarotrigo\/blog-assets\/videos\/css-snaps\/not-use-css-snaps-small-sections.mp4\" type=\"video\/mp4\" \/>\n\t\t\t\tYour browser does not support the video tag.\n\t\t\t\t<\/source><\/source><\/video>\n\t\t\t<\/a>\n\t\t<\/p>\n\n\n\n<p>You can test it yourself in the following Codepen:<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_bGLGZZG\" data-src=\"\/\/codepen.io\/anon\/embed\/bGLGZZG?height=450&amp;theme-id=1&amp;slug-hash=bGLGZZG&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed bGLGZZG\" title=\"CodePen Embed bGLGZZG\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"creating-an-infinite%2Flooping-scroll-will-be-tricky\">Creating an infinite\/looping scroll will be tricky<\/h2>\n\n\n<p>One thing that doesn&#8217;t quite work with scroll snap is an infinite, looping scroll (or should that be an infinite, scrolling loop?). This is because the elements within the scrollport are positioned alongside each other &#8211; they don&#8217;t loop by default.<\/p>\n\n\n\n<p>So what happens when you reach the last item, and then try to keep scrolling onwards?<\/p>\n\n\n\n<p>Well, out of the box, nothing. You&#8217;ve reached the end of the content, and you can&#8217;t scroll any further. Most sliders reach a compromise here &#8211; with some fancy CSS and a navigation buttons, you can set the slider so that a click on the <em>forward<\/em> navigation when on the last slide, will roll you back to the beginning:<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_bGqgqeK\" data-src=\"\/\/codepen.io\/anon\/embed\/bGqgqeK?height=450&amp;theme-id=1&amp;slug-hash=bGqgqeK&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed bGqgqeK\" title=\"CodePen Embed bGqgqeK\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p>This is fine, and a lot of sites do this. But you don&#8217;t get that cool infinite loop effect!<\/p>\n\n\n\n<p>So you&#8217;ll need to use JavaScript for this &#8211; for example, <a href=\"https:\/\/alvarotrigo.com\/fullPage\/examples\/continuous.html\">here&#8217;s how it looks in fullPage.js<\/a>. Note how you can reach the third and final slide, but then keep scrolling. You end up at the first slide again, but instead of rolling back to the start &#8211; you get the impression of continuous scrolling. I don\u2019t know about you, but I think that\u2019s pretty cool.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"chrome-issues-skipping-elements-with-css-scroll-snap\">Chrome issues skipping elements with css scroll snap<\/h2>\n\n\n<p>As for today, css scroll snapping doesn&#8217;t work as one would expect when using a mouse wheel on Chrome.<\/p>\n\n\n\n<p>Users can experience skipping of blocks when the scroll finishes and can end up annoying visitors quite a lot.<\/p>\n\n\n\n<p>This has <a href=\"https:\/\/stackoverflow.com\/a\/61727408\/1081396\" target=\"_blank\" rel=\"noopener nofollow\">been reported<\/a> <a href=\"https:\/\/stackoverflow.com\/q\/61423085\/1081396\" target=\"_blank\" rel=\"noopener nofollow\">multiple<\/a> <a href=\"https:\/\/stackoverflow.com\/q\/56574488\/1081396\" target=\"_blank\" rel=\"noopener nofollow\">times<\/a> on stackoverflow and it seems to be a Chrome bug.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"scroll-snap-doesn't-give-you-breadcrumbs-or-navigation-out-of-the-box\">Scroll snap doesn&#8217;t give you breadcrumbs or navigation out-of-the-box<\/h2>\n\n\n<p>Scroll snap is just a CSS module, it has one job &#8211; to move the scrollport to a specified position. It&#8217;s not an all-singing all-dancing framework that can do multiple things.<\/p>\n\n\n\n<p>If you&#8217;re planning to do something more complex like a slider or a full page site, that&#8217;s great! Just realise that scroll snap is one piece of that puzzle. If you want to add some other traditional functions like navigation buttons or breadcrumbs, you&#8217;ll need to combine it with other CSS and\/or JavaScript.<\/p>\n\n\n\n<p>One cool advantage of CSS snaps is that it does something we previously had to do with JavaScript. If you can do something in CSS rather than JS, you usually should, so that visitors with JS turned off will still be able to use the site normally.<\/p>\n\n\n\n<p>So if you wanted to make something like a <a href=\"https:\/\/alvarotrigo.com\/fullPage\/blog\/create-a-slider-with-pure-CSS\/\">slider with pure CSS<\/a>, that is possible &#8211; to an extent. But you&#8217;re somewhat limited in what you can do with pure CSS. In many cases you&#8217;ll probably need to throw in some JS too, to get your site doing exactly what you want.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"scroll-snap-is-just-not-a-complete-library\">Scroll Snap Is Just Not a Complete Library<\/h2>\n\n\n<p>It&#8217;s like comparing Apples to Oranges.<\/p>\n\n\n\n<p>Scroll Snaps is a single CSS feature that achieves a very specific scrolling behavior.<\/p>\n\n\n\n<p>If you are looking for a <a href=\"https:\/\/alvarotrigo.com\/blog\/scroll-snap-alternative\/\" data-type=\"post\" data-id=\"15619\">CSS Scroll Snap alternative<\/a>, then fullPage.js is a JavaScript library that comes with a huge range of configurable <a href=\"https:\/\/alvarotrigo.com\/fullPage\/docs\/#options\">options<\/a>, <a href=\"https:\/\/alvarotrigo.com\/fullPage\/docs\/#methods\">methods<\/a>, and <a href=\"https:\/\/alvarotrigo.com\/fullPage\/docs\/#callbacks\">callbacks<\/a>.<\/p>\n\n\n\n<p>They have one single thing in common. They provide a similar scrolling effect. Apart from that, Scroll Snaps doesn&#8217;t provide any other additional features, while fullPage.js provides a ton.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>A quick look at the <a href=\"https:\/\/alvarotrigo.com\/fullPage\/docs\/\">fullpage.js documentation<\/a> is enough to know fullPage.js is <strong>way more than a scrolling effect<\/strong>.<\/p>\n<\/blockquote>\n\n\n\n<p>So, what does this mean to you as a web developer?<\/p>\n\n\n\n<p>It means that fullPage.js comes with a set of tools that can save you <strong>a lot<\/strong> of time while developing a page. Things like navigation bullets, enable\/disable scroll based on whatever conditions you need, responsive options, control over keyboard scrolling, the trigger of actions on different states of the movement, scrollable sections, etc.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"getting-the-right-tools-for-the-job\">Getting the right tools for the job<\/h2>\n\n\n<p>Don&#8217;t get me wrong here &#8211; scroll snap is awesome and brings into CSS something that we previously could only do with JS. I just wanted to tell you a little more about what it can and can&#8217;t do. If you&#8217;re looking to make something a little more complex, you&#8217;ll need to add in a lot more CSS and probably JS to get the effect you want.<\/p>\n\n\n\n<p>And if the thing you have in mind is a full-page site that snaps nicely onto the different sections, why re-invent the wheel? <a href=\"http:\/\/alvarotrigo.com\/fullPage\/\" target=\"_blank\" rel=\"noopener nofollow\">Check out fullPage.js<\/a> instead! Why? Well, because&#8230;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>It resolves all of the issues discussed here &#8211; and a <a href=\"https:\/\/alvarotrigo.com\/fullPage\/#examples\">whole lot more<\/a>.<\/li>\n\n\n\n<li>It&#8217;ll save you A LOT of time &#8211; you can take the time you would have spent coding up your own solution and do other stuff instead.<\/li>\n\n\n\n<li>It&#8217;s really easy to set up and highly customizable.<\/li>\n\n\n\n<li>It provides tens of features that you will soon start missing if you start making a site with CSS scroll snaps. (Callbacks, CSS state classes, responsive options, URL hash, methods, scrollable sections etc.)<\/li>\n<\/ul>\n\n\n\n<p>Basically it\u2019s a ready-made, works out-of-the-box solution for full page sites &#8211; check it out!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You don&#8217;t want to use CSS scroll snap for certain cases. It is definetely not the perfect solution for all your sliding problems. We will explain the main reasons why this css effect is not for everybody.<\/p>\n","protected":false},"author":6,"featured_media":5922,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[108],"tags":[9,43,17,67],"class_list":["post-5923","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sliders","tag-css","tag-slider","tag-web","tag-web-design"],"acf":[],"_links":{"self":[{"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/posts\/5923","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/comments?post=5923"}],"version-history":[{"count":7,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/posts\/5923\/revisions"}],"predecessor-version":[{"id":15626,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/posts\/5923\/revisions\/15626"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/media\/5922"}],"wp:attachment":[{"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/media?parent=5923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/categories?post=5923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/tags?post=5923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}