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

grapesjs-plugin-scroll

v1.0.7

Published

Scroll animations component for GrapesJs

Downloads

276

Readme

GrapesJS Scroll Animation

Scroll animations component for GrapesJs

Demo

Requirements

  • GrapesJS v0.13.8 or higher

Summary

  • Plugin name: grapesjs-plugin-scroll
  • Components
    • Scroll - Div component which triggers the animations
    • Scroll-content - Default content that's rendered by the scroll animation
  • Blocks
    • Scroll

Options

| Option | Description | Example | | --------------- | -------------------------------- | ----------------------------------------------------------------------------------------------- | | gjsScrollContent | A function returning the html content of the Scroll-content component as a string | (prefix, componentType) => `<h3 data-gjs-type="${componentType}" class="${prefix}-h3">Section Text</h3>` | gjsScrollInnerStyles | A function returning the css styles of the Scroll-content component as a string | (prefix) => `.${prefix}-container h1{ font-size: 3rem;}` | gjsScrollPrefix | The string that preceds every class | gjs-scroll (default) | gjsScrollStyles | A function returning the html content of the Scroll-content component as a string | (prefix) => `.${prefix}-container { min-height: 100vh; } | gjsScrollBlockName | The name of the block as it appears in the block manager | Scroll (default)

Download

  • GIT
    • git clone https://github.com/benjgrad/grapesjs-plugin-scroll.git

Integration

Directly in the browser

<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/>
<script src="https://unpkg.com/grapesjs"></script>
<script src="https://unpkg.com/grapesjs-plugin-scroll"></script>

<div id="gjs"></div>

<script type="text/javascript">
  var editor = grapesjs.init({
      container : '#gjs',
      ...
      plugins: ['grapesjs-plugin-scroll'],
      pluginsOpts: {
        'grapesjs-plugin-scroll': 
        { 
          // options
        }
      }
  });

</script>

Modern javascript

import grapesjs from 'grapesjs';
import gjsScroll from 'grapesjs-plugin-scroll';

const editor = grapesjs.init({
  container : '#gjs',
  // ...
  plugins: [gjsFogjsScrollrms],
  pluginsOpts: {
    [gjsScroll]: { /* options */ }
  }
  // or
  plugins: [
    editor => gjsScroll(editor, { /* options */ }),
  ],
});

Development

Clone the repository

$ git clone https://github.com/benjgrad/grapesjs-plugin-scroll.git
$ cd grapesjs-plugins-scroll

Install dependencies

$ npm i

Start the development server

$ npm start

Usage

The animations trigger when the style class gjs-scroll-active is added to the html element, which happens when the user scrolls past a threshold. This means that if you want to edit the animation, you will need to edit the transition or transform with the class selected. The style class gjs-scroll-inactive alternatively, will be used when the user scrolls up. In the example above, the opacity is set to 0 and the element is moved down by the styles of gjs-scroll-inactive until the user scrolls past the threshold. Once the user scrolls past the threshold, the styles of gjs-scroll-active will set the opacity to 1 (so it can be seen) and move the element up.

To edit animations that will apply before the user hits the scroll threshold, select the class gjs-scroll-inactive in the style manager. You can then edit any of the attributes in the style manager, including the animation, which can be found under Extra.

To edit animations that will apply after the user reaches the scroll threshold, select the class gjs-scroll-active in the style manager. These style changes will only apply as long as the user has passed the scroll threshold. If they scroll up, the element will be reset and the changes will take place again once the user scrolls down.

Multiple Animations

To use a variety of different animations in your site, specify the animation type in the settings. This will add the type prefix to your classes. For example, if your Type is "disappear", your new classes will be disappear_gjs-scroll-inactive and disappear_gjs-scroll-active. You can then specify the animation that will trigger when the scroll threshold is hit as described above.

License

MIT