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

@alzintani/superevents

v0.2.2

Published

JavaScript library that handling any events in websites.

Downloads

9

Readme

SuperEvents

JavaScript Scroll, Hover, Mouse move and Click effects library.

Examples


Table of Contents


Description

Often, when events happen, you may want to do something. SuperEvents allows you applying actions to target elements when events are detected in source element. SuperEvents right now can handel these events:-

  • Click
  • Hover
  • Mouse Move
  • Scroll

Installation

Download the latest version of SuperEvents from GitHub repository. Include SuperEvents.min.js to your HTML file.

<script src="/path/to/SuperEvents.min.js"></script>

And SuperEvents is ready to use!


Quickstart

First, you have to create an instance by passing the source element(s) and the target element(s) in object to SuperEvents, for example:-

var scrollInstance = new SuperEvents({
  source: document.getElementById('any-element-id'),
  target: document.querySelectorAll('.click-example-target')
});

Then you have to call the event function and pass the required parameters (some of functions does't required any parameters or you can keep it empty to use default values) for example for scroll event call this function:

var scrollEvent = scrollInstance.scroll({
  indicator: '80%',
  duration: '20%',
});

indicator and duration is the space where you can apply the action.

Then call the action function:-

var scrollAction = scrollEvent.fromTo({ color: '#00FF00' }, { color: '#FF0000' });

finally call the easing function like this way:-

scrollAction.easing({
  timing:'linear',
  duration: 0.3,
  delay: 0.3,
  cubicBezier: false
});

easing function is Optional

See some examples with code


API Documentation

Event Functions

  • scroll( params = {} ): {object}
    • Description: The scroll event fires when the document view or an element has been scrolled.
    • Parameters:- params:
      • name: params
      • Description: The parameters
      • type: object
      • optional: true
      • default:
{
    indicator: '80%', //
    duration: '20%', //
    listener: 'load', //
    debug: false // Display debug lines for scrolling postion and start and end ponts
}

  • mousemove(): {object}
    • Description: The mousemove function occurs when the mouse move over the target element.
    • Parameters:- null

  • click()
    • Description: Execute a JavaScript when click the target element.
    • Parameters:- null

  • .mousemove()
    • Description: The hover function occurs when the mouse pointer is over the selected element.
    • Parameters:- null

Action Functions

  • call( callback ): {object}
    • Description: Scale in/out target element(s)
    • Parameters: Boolean true, default value:- true (set it to false for scale out)

  • fromTo( scrollEventFrom = {}, scrollEventTo = {} ): {object}
    • Description: From and To action
    • Parameters: Object {}, Object {}
      • example:
event.fromTo(
  { color: '#FFF' },
  { color: '#999' }
)

Easing (Optional)

  • easing( params = {} ): {object}
    • Parameters: String '', Float 1, Boolean false
      • example:
event.easing({
  timing:'linear',
  duration: 0.3,
  delay: 0.3
});

Contributing

Want to get involved with SuperEvents? Here's how you can help.

Fork SuperEvents, clone your fork, and configure the remotes:

# Get code from repostery
git clone https://github.com/<your-username>/SuperEvents.git

# Change your way to cloned directory
cd SuperEvents

# Configure the remotes
git remote add upstream https://github.com/alzintani/SuperEvents.git

Install required packages npm install then run npm run build to build main files and documentation files.

Now you can run npm start

To display the documentation go to http://localhost:3001 from your browser.


Real Example


Copyright and license

SuperEvents 2020 Hassan Matooq. Code released under the MIT license.