jquery - Snap Scroll in depth with JavaScript/CSS -
i need go deep scroll snap , help.
i need achieve 3 effects:
able draggable
able scroll smoothly anchor
able trigger simple animation changing color when content it's snapped
you can use css / javascript / jquery / etc... achieve desired effects. here's snippet no results far:
a, span { position: absolute } h1 { font-size: 40px; } .child { width: 400px; height: 400px; position: relative; background-color: #f0f0f0; display: inline-block; margin-right: -4px; border: 1px solid black; } .label { width: 200px; height: 200px; border-radius: 25%; background-color: white; margin: 100px auto 0 auto; } .label > h1 { font-size: 80px; padding-left: calc(50% - 22px); padding-top: calc(50% - 60px); } .container { width: 402px; height: 410px; overflow-x: auto; overflow-y: hidden; white-space: nowrap; -webkit-overflow-scrolling: touch; margin: 10vh auto 0 auto; } #snap-scroll-container { -webkit-scroll-snap-type: mandatory; scroll-snap-type: mandatory; -webkit-scroll-snap-points-x: repeat(100%); scroll-snap-points-x: repeat(100%); }
<div class="container" id="snap-scroll-container"> <div class="child"> <div class="label"> <h1>1</h1> <a href="#3">i must smooth scroll 3!</a> </div> </div> <div class="child"> <div class="label"> <h1>2</h1> <span>i must change color when snaps!</span> </div> </div> <div id="3" class="child"> <div class="label"> <h1>3</h1> <span>scroll must draggable too!</span> </div> </div> </div>
your appreciated!
Comments
Post a Comment