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

standoutjs

v3.1.0

Published

A jQuery plugin that creates events when a certain DOM element is in a position relative to a selected portion of the viewport.

Downloads

29

Readme

standoutjs

Installation

CDN

Insert this code after jQuery import:

<script src="https://cdn.jsdelivr.net/npm/standoutjs@latest/dist/standout.min.js"></script>

NPM

Install using npm:

npm install standoutjs

YARN

Install using yarn:

yarn add standoutjs

Then load it into your app.js:

require('standoutjs');

Basic usage

$(yourSelector).standout();

Customizing the options

$(yourSelector).standout({
        onlyFirstTime: true,
        top: 0.4,
        bottom: 0.2
});

Enabling the lightbox effect

$(yourSelector).standout({
        lightBoxEffect: true,
        top: 0.4,
        bottom: 0.2
});

NOTE: the lightbox effect will override both the onlyFirstTime and the oncePerEvent options in order to work properly.

Using the events

$(yourSelector).standout({
        top: 0.4,
        bottom: 0.2
}).on("ET", function(event, object) {
    console.log("ENTERING FROM TOP " + obj.idx);
});

NOTE: you can chain all the events as you do for any other jQuery event

Events list

  • ET
    • Fired when the element is ENTERING from the TOP of the defined area
  • EXT
    • Fired when the element is EXITING from the TOP of the defined area
  • EB
    • Fired when the element is ENTERING from the BOTTOM of the defined area
  • EXB
    • Fired when the element is EXITING from the BOTTOM of the defined area
  • C
    • Fired when the element is at the CENTER of the defined area
  • O
    • Fired when the element is OVER the TOP of the defined area and inside the viewport
  • U
    • Fired when the element is UNDER the BOTTOM of the defined area and inside the viewport

Options

Options are sent to the plugin as an object.

Below you can find the name and definition of all the available options for this plugin.


onlyFirstTime

Boolean - Default: false

Force the plugin to fire the events only once


oncePerEvent

Boolean - Default: true

Force the plugin to fire the events only once


showDemoLayout

Boolean - Default: false

Displays the area of effect of the plugin.


lightBoxEffect

Boolean - Default: false

Activate the lightbox effect for the elements the plugin is enabled for


backgroundColor

CSS color value - Default: #000000

NOTE: Option NO longer implemented - Will be removed in future versions of the plugin


top

Float - Default: 0.3

This value defines the top limit of the plugin's area of effect (calculated as percentage of the viewport - starting from the top)

I.E. A value of 0.3 means that the top limit is calculated at 30% of the viewport height, starting from the top.


bottom

Float - Default: 0.3

This value defines the bottom limit of the plugin's area of effect (calculated as percentage of the viewport - starting from the bottom)

I.E. A value of 0.3 means that the bottom limit is calculated at 30% of the viewport height, starting from the bottom.


overlay: {
    backgroundColor: "#000000",
    opacity: "0",
    width: "100%",
    height: "100%",
    position: "fixed",
    top: "0",
    left: "0",
    zIndex: "9999",
    display: "none"
},

Object - Default: as defined above

The CSS properties of the overlay element used for the lightbox effect.

NOTE: for the best effect is advised to leave all the options with their default value.


overlayId

String - Default: overlayStandout

The default ID used for the overlay element. You can change this if needed.


enabled

Boolean - Default: false

NOTE: NOT YET IMPLEMENTED - Will be implemented in future versions of the plugin

Enable or disable the plugin.


Requirements

jQuery >= 1.9.1

Credits

Basic plugin structure from: https://github.com/alvinpascoe/jquery-boilerplate

Tips and technical support: www.manvitech.it

Moral support: Lois, my love