
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
alpinejs-scroll-to
Advanced tools
Easily add scroll to functionality with options, powered by Alpine JS 🐭
Easily add scroll to functionality with options, powered by Alpine JS 🐭
<script
defer
src="https://unpkg.com/alpinejs-scroll-to@latest/dist/scroll-to.min.js"
></script>
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
yarn add -D alpinejs-scroll-to
npm install -D alpinejs-scroll-to
import Alpine from 'alpinejs'
import scrollTo from 'alpinejs-scroll-to'
Alpine.plugin(scrollTo)
Alpine.start()
<!-- This will scroll to `#AboutContent` on Alpine init -->
<div x-data x-init="$scrollTo({ targetId: 'AboutContent' })">
<header x-scroll-to-header class="fixed h-20 top-0 inset-x-0 z-50 ">
...
</header>
<div>
<nav>
<!--
This will scroll to `#AboutContent` when clicked with smooth scrolling
disabled and the header height will be offset meaning no overlap
-->
<a
href="#AboutContent"
x-on:click.prevent="$scrollTo({ offsetHeader: true, useSmooth: false })"
>
About
</a>
<!--
This will scroll to `#TeamContent` when clicked with smooth scrolling
enabled but the header height will not be offset meaning overlap
-->
<a href="#TeamContent" x-on:click.prevent="$scrollTo"> Team </a>
</nav>
<div class="my-[100vh]">
<div id="AboutContent"> About </div>
<div id="TeamContent"> Team </div>
</div>
</div>
</div>
targetId
This expects the id
of an element to scroll to without the #
.
Useful for when you aren't triggering the scroll to from an anchor tag.
offsetHeader
By default this is false
.
Setting this to true
will offset the height of the header element when you
scroll. No more overlap!
You target the header element by applying x-scroll-to-header
to it.
<header x-scroll-to-header class="fixed h-20 top-0 inset-x-0 z-50">
...
</header>
useSmooth
By default this is true
.
Setting this to false
will remove the smooth scroll, instead it will be
instant.
FAQs
Easily add scroll to functionality with options, powered by Alpine JS 🐭
The npm package alpinejs-scroll-to receives a total of 56 weekly downloads. As such, alpinejs-scroll-to popularity was classified as not popular.
We found that alpinejs-scroll-to demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.