JScroll
No description available
Install / Use
/learn @jesperlandberg/JScrollREADME
JScroll
Smooth scrolling sections based on <a href="http://www.everyday3d.com/blog/index.php/2014/08/18/smooth-scrolling-with-virtualscroll/">VirtualScroll</a>.
Usage
Install
yarn add @twotwentytwo/jscroll
Javascript
import JScroll from '@twotwentytwo/jscroll'
JScroll.init({ /* Options are optional */ })
Markup
<div data-smooth> <!-- Add data-smooth to your container -->
<div data-smooth-item></div>
<div data-smooth-item></div>
<div data-smooth-item data-speed="1.1"></div> <!-- Use data-speed to control speed of item -->
<div>
<div>
<div data-smooth-item></div> <!-- No need to be top lvl -->
</div>
</div>
<div data-smooth-item>
<div data-smooth-item data-speed="0.75"></div> <!-- Can be nested for parallax effects -->
</div>
</div>
Options
ease: Easing value (defaults to 0.1)
scrollbar: Virtual scrollbar (defaults to false)
disableMobile: Disable JScroll on mobile devices (defaults to true)
preload: Trigger resize after loading all images (defaults to false)
vs:
mouseMultiplier: Defaults to 0.45touchMultiplier: Defaults to 2.5firefoxMultiplier: Defaults to 90
Methods
init(): Initialise instance
update(): Update instance
resize(): Trigger resize
preload(): Preload images
tick(): Where the magic happens
stop(): Stop scrolling
resume(): Resume scrolling
destroy(): Clean instance
scrollTo(someElement.offsetTop): Anchor scroll
Events
on('tick', ({ target, current }) => {}): Raf callback. Scroll and lerped scroll params.
on('scroll', ({ delta, target }) => {}): Scroll callback. Delta and scroll params.
Getters
getSmooth: Returns lerped scroll value
getScroll: Returns scroll value
References
Some great examples of sites using JScroll.
<a href="https://www.crrtt.com/" target="_blank">Fabio Caretti</a><br> <a href="https://discoverylandco.com" target="_blank">Discoverylandco</a>
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
