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 🙏

© 2025 – Pkg Stats / Ryan Hefner

goto-js

v0.0.2

Published

A minimalistic library that provides a pure javascript-based scrollTo method with smoothing.

Readme

goto-js


Description

goto-js is a minimalistic javascript-based library that enables the user to have scrolling or goTo functionality with a smoothing algorithm. The smoothing algorithm can either be linear or a sine-like smoothing function, similar to that of fadeInfadeOut found in CSS.


Installation

The easiest method of installation would be to use npm. npm install goto-js

Otherwise, feel free to do a git clone git clone https://github.com/tfaticone/goto-js.git


How to Use

goto-js only has one entry point, the function goTo. In order to use goTo there are only a few basic pieces of information required: the final x and y position and the duration of the transition. There are a set of optional inputs that add some customization to the needs of the user. For example, initial start position, smoothing algorithm, total number of steps, and element are all optional.

Basic Format

Just as a reminder the required inputs are:

  1. Finishing x-coodrinate
  2. Finishing y-coordinate
  3. Time duration of the transition (in milliseconds)

The optional inputs are:

  1. The smoothing algorithm (either fadeInfadeOut or linear, default is fadeInfadeOut)
  2. Initial x-coordinate (Default is current x position)
  3. Initial y-coordinate (Default is current y position)
  4. Total Number of 'steps' (increments, default is 60fps * time [in seconds])
  5. A DOM element to act as the final location (this will override the final x and y coordinate)

With these in mind the basic format is:

var gotojs = require('goto-js');
gotojs.goTo(xf, yf, time, {
    smooth,
    xi,
    yi,
    totalSteps,
    element
});

Examples

Assuming that var gotojs = require('goto-js');

Example 1

In order to go to (50,100) from the current position in 2 seconds, the call would be as follows: gotojs.goTo(50, 100, 2000);

Example 2

In order to go from (25,50) to (300,10) with the duration of the transition being 4 seconds, the function call would be

gotojs.goTo(300, 10, 4000,{
    xi = 25,
    yi = 50
});
Example 3

In order to go from (25,50) to (300,10) with the duration of the transition being 4 seconds within 100 steps, the function call would be

gotojs.goTo(300, 10, 4000,{
    xi = 25,
    yi = 50,
    totalSteps = 100
});
Example 4

In order to go from (25,50) to (300,10) with the duration of the transition being 4 seconds using the linear algorithm, the function call would be

gotojs.goTo(300, 10, 4000,{
    xi = 25,
    yi = 50,
    smooth = 'linear'
});
Example 5

In order to go from (25,50) to element button with the duration of the transition being 4 seconds using the linear algorithm, the function call would be

var button = document.querySelector('button');
gotojs.goTo(0, 0, 4000,{
    xi = 25,
    yi = 50,
    element = button
});

** As a side note, the final x and y coordinates will be overridden with the x and y coordinates of the element.


Contributions

Thomas Faticoone [email protected]

Feel free to email with any suggestions.

Note This is in early stages. Lots of developement is still to be done.