UNPKG

flipflop-scroll

Version:

A tiny vanilla JS library to scroll section by section

132 lines (126 loc) 3.07 kB
html { position: absolute; top: 0; bottom: 0; height: 100%; width: 100%; overflow: hidden; background: #ffffff; padding: 0; margin: 0; -webkit-overflow-scrolling: auto; } body { margin: 0; height: 100vh; -webkit-overflow-scrolling: touch; overflow: auto; scroll-behavior: auto; /* // -webkit-scroll-snap-type: proximity; // -ms-scroll-snap-type: proximity; // scroll-snap-type: proximity; // -webkit-scroll-snap-destination: 0% 100%; // -ms-scroll-snap-destination: 0% 100%; // scroll-snap-destination: 0% 100%; // -webkit-scroll-snap-points-y: repeat(100%); // -ms-scroll-snap-points-y: repeat(100%); // scroll-snap-points-y: repeat(100%); */ } /* // body:active { // cursor: -webkit-grabbing; // cursor: grabbing; // } */ section { box-sizing: border-box; width: 100%; // height: 0; min-height: 100vh; scroll-snap-align: start; } #flip_flop_nav { z-index: 1; position: absolute; top: 50%; transform: translateY(-50%); right: 40px; } #flip_flop_nav .dot { box-sizing: border-box; border-radius: 100px; padding: 12px; -webkit-transition: all 100ms; -o-transition: all 100ms; transition: all 100ms; margin-bottom: 2px; cursor: pointer; } #flip_flop_nav .dot:after { content: ''; background-color: rgba(255, 255, 255, 0.4); display: block; width: 8px; height: 8px; border-radius: 100px; } #flip_flop_nav .dot:hover { background: rgba(0, 0, 0, 0.2); } #flip_flop_nav .dot:active { background: rgba(0, 0, 0, 0.4); } #flip_flop_nav .dot:active:after { background-color: rgba(255, 255, 255, 0.6); } #flip_flop_nav .dot.on { opacity: 1; background: rgba(0, 0, 0, 0.1); } #flip_flop_nav .dot.on:after { background-color: rgba(255, 255, 255, 0.8); } #flip_flop_nav .dot:last-of-type { border-radius: 0; margin-bottom: 0; } /* .indicator { height: 8px; width: 8px; background-color: white; border-radius: 100px; padding: 0px; margin: 0px; } .square-indicator { height: 8px; width: 8px; opacity: 1; background-color: #000014; } */ #flip_flop_nav .dot:last-of-type.on { transform: scale(1.2) rotate(45deg); } /* only for IE 10 + */ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { #flip_flop_nav .dot { -webkit-transition: none; -o-transition: none; transition: none; } } /* only for edge */ @supports (-ms-ime-align: auto) { /* == this is bloody important for some reason ==*/ html { overflow: initial; } /* == end important ==*/ #flip_flop_nav { position: fixed; } #flip_flop_nav .dot { -webkit-transition: none; -o-transition: none; transition: none; } } @media screen and (max-width: 768px) { #flip_flop_nav { right: 16px; } #flip_flop_nav .dot:hover { background: inherit; } #flip_flop_nav .dot.on:hover { opacity: 1; background: rgba(0, 0, 0, 0.1); } }