npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@frankhoodbs/scroll-progress-helper

v1.1.2

Published

Scroll Progress Helper

Downloads

259

Readme

Scroll Progress Helper

Scroll Progress Helper is a utility for Vue 3 applications that provides a composable function to calculate and track the scroll progress between specified elements. It allows you to monitor the user's scroll position and integrate dynamic behaviors based on the scroll progress within your Vue components.

Version License

Installation

Install the utility using npm:

npm install @frankhoodbs/scroll-progress-helper

Usage

Import the utility in your Vue component:

import useScrollProgressHelper from '@frankhoodbs/scroll-progress-helper';

Use the utility within your component:

const { progress } = useScrollProgressHelper({
  startElement: HTMLNodeOrRef, /* your start element reference */
  endElement: HTMLNodeOrRef, /* your end element reference */
  // Additional configuration options if needed
});

Access the scroll progress:

// Reactively access the scroll progress as a computed property
console.log(progress.value); // Current scroll progress as a percentage (0 to 100)

Configuration Options

| Option | Description | Default Value | |-----------------------------|-------------------------------------------------------------------|---------------| | scroller | The element used as the scroll container. | window | | startElement | The reference to the starting element for scroll tracking. | - | | startTriggerPoint | The trigger point within the starting element ('start' or 'end'). | 'start' | | endElement | The reference to the ending element for scroll tracking. | - | | endTriggerPoint | The trigger point within the ending element ('start' or 'end'). | 'end' | | scrollerIntersectionPoint | Percentage of the scroller height used to determine intersection. | 50 |

Example

<template>
    <div class="App">
        <div ref="$start">...</div>
        <div ref="$end">...</div>
        <progress class="progress" :value="progress" max="100">{{ progress }}%</progress>
    </div>
</template>

<script setup lang="ts">
import useScrollProgressHelper from '@frankhoodbs/scroll-progress-helper';
import { ref } from 'vue';

const $start = ref<HTMLElement | null>(null);
const $end = ref<HTMLElement | null>(null);

const { progress } = useScrollProgressHelper({
  startElement: $start,
  endElement: $end,
});
</script>