All Projects → vgshenoy → Vue Scrollama

vgshenoy / Vue Scrollama

Licence: mit
Vue component to easily setup scroll-driven interactions (aka scrollytelling)

Labels

Projects that are alternatives of or similar to Vue Scrollama

window-scroll-position
React hook for Window scroll position
Stars: ✭ 81 (-75.15%)
Mutual labels:  scroll
Phytouch
Smooth scrolling, rotation, pull to refresh, page transition and any motion for the web - 丝般顺滑的触摸运动方案
Stars: ✭ 2,854 (+775.46%)
Mutual labels:  scroll
Uumarqueeview
[iOS]Customizable marquee view. #Marquee,MarqueeView,跑马灯,滚屏,上翻,左滑,多行,自定义
Stars: ✭ 295 (-9.51%)
Mutual labels:  scroll
linux-scroll-speed-fix
A Chrome app that fixes the slow scroll speed in Chrome for Linux.
Stars: ✭ 33 (-89.88%)
Mutual labels:  scroll
UUAmountBoardView
[iOS]带有数字(金额)滚动效果的UI控件
Stars: ✭ 37 (-88.65%)
Mutual labels:  scroll
Inview notifier list
A Flutter package that builds a list view and notifies when the widgets are on screen.
Stars: ✭ 269 (-17.48%)
Mutual labels:  scroll
react-infinite-scroll-list
Manage infinite list with the IntersectionObserver API
Stars: ✭ 20 (-93.87%)
Mutual labels:  scroll
Scrollmonitor
A simple and fast API to monitor elements as you scroll
Stars: ✭ 3,250 (+896.93%)
Mutual labels:  scroll
postcss-momentum-scrolling
PostCSS plugin add 'momentum' style scrolling behavior (-webkit-overflow-scrolling: touch) for elements with overflow (scroll, auto) on iOS
Stars: ✭ 69 (-78.83%)
Mutual labels:  scroll
React Horizontal Scrolling Menu
Horizontal scrolling menu component for React.
Stars: ✭ 289 (-11.35%)
Mutual labels:  scroll
srraf
Monitor scrolling and resizing without event listeners.
Stars: ✭ 26 (-92.02%)
Mutual labels:  scroll
ClockScroller
A cool animated RecyclerView clock face scroller handle inspired by the following MaterialUp submission - https://material.uplabs.com/posts/codepen-scrolling-clock
Stars: ✭ 75 (-76.99%)
Mutual labels:  scroll
Ngx Scroll To
Scroll to any element to enhance scroll-based features in you app. Works for Angular 4+, both AoT and SSR. No dependencies.
Stars: ✭ 269 (-17.48%)
Mutual labels:  scroll
lovelace-plotly-graph-card
Highly customisable Lovelace card to display interactive graphs. Brings scrolling, zooming, and much more!
Stars: ✭ 38 (-88.34%)
Mutual labels:  scroll
React Native Pagination
Animated Pagination For React Native's ListView, FlatList, and SectionList
Stars: ✭ 296 (-9.2%)
Mutual labels:  scroll
scrollparent.js
A function to get the scrolling parent of an html element.
Stars: ✭ 51 (-84.36%)
Mutual labels:  scroll
Wrnavigationbar
超简单!!! 一行代码设置状态栏、导航栏按钮、标题、颜色、透明度,移动等 WRNavigationBar which allows you to change NavigationBar's appearance dynamically
Stars: ✭ 2,923 (+796.63%)
Mutual labels:  scroll
Asscroll
Ash's Smooth Scroll 🍑
Stars: ✭ 324 (-0.61%)
Mutual labels:  scroll
Vue Happy Scroll
基于vue2.0实现的滚动条插件。scroll component for vue2.0
Stars: ✭ 299 (-8.28%)
Mutual labels:  scroll
Swiftuix
Extensions and additions to the standard SwiftUI library.
Stars: ✭ 4,087 (+1153.68%)
Mutual labels:  scroll

Vue Scrollama

Vue logo scrollama.js

A Vue component to easily setup scroll-driven interactions (aka scrollytelling). Uses Scrollama under the hood.

Jump straight to examples here.

Installation

npm install vue-scrollama intersection-observer

Scrollama makes use of IntersectionObserver and you'll want to manually add its polyfill intersection-observer for cross-browser support.

Basic Usage

Any elements placed directly inside a Scrollama component will be considered as steps. As the user scrolls, events will be triggered and emitted which you can handle as required:

  • step-enter: when the top or bottom edge of a step element enters the offset threshold
  • step-exit: when the top or bottom edge of a step element exits the offset threshold
  • step-progress: continually fires the progress (0-1) a step has made through the threshold

Here's a simple example with three <div> elements as steps and a step-enter event

<template>
  <Scrollama @step-enter="stepEnterHandler">
    <div class="step1" data-step="a">...</div> // classes like .step1 are helpful to adjust the style and dimensions of a step
    <div class="step2" data-step="b">...</div> // data-* attributes are helpful to store instructions to be used in handlers
    <div class="step3" data-step="c">...</div>
  </Scrollama>
</template>

<script>
import 'intersection-observer' // for cross-browser support
import Scrollama from 'vue-scrollama'

export default {
  components: {
    Scrollama
  },
  methods: {
    stepEnterHandler ({element, index, direction}) {
      // handle the step-event as required here
      console.log(element, index, direction)
    }
  }
}

<style src="vue-scrollama/dist/vue-scrollama.css"></style>
<style>
/* your styles here */
</style>

NuxtJS Usage

For usage with NuxtJS & for SSR support, you must create a custom NuxtJS plugin.

Create plugin

plugins/scrollama.client.js

import Vue from 'vue';
import 'intersection-observer' // for cross-browser support
import Scrollama from 'vue-scrollama'

Vue.component('Scrollama', Scrollama);

Include in nuxt.config.js

nuxt.config.js

  plugins: [
    { src: '~/plugins/scrollama.client.js' }
  ]

Usage

Use Scrollama in your components/templates, etc.

<template>
  <client-only>
    <Scrollama @step-enter="stepEnterHandler">
      <div class="step1" data-step="a">...</div> // classes like .step1 are helpful to adjust the style and dimensions of a step
      <div class="step2" data-step="b">...</div> // data-* attributes are helpful to store instructions to be used in handlers
      <div class="step3" data-step="c">...</div>
    </Scrollama>
  </client-only />
</template>

<script>
export default {
  methods: {
    stepEnterHandler ({element, index, direction}) {
      // handle the step-event as required here
      console.log(element, index, direction)
    }
  }
}

<style src="vue-scrollama/dist/vue-scrollama.css"></style>
<style>
/* your styles here */
</style>

Sticky Graphic

To add a sticky graphic element (example), place it into a slot with name 'graphic'.

// classes are helpful to adjust the style and dimensions of the graphic
<template>
  <Scrollama @step-enter="stepEnterHandler">
    <div slot="graphic" class="graphic">...</div> 
    <div class="step1" data-step="a">...</div>
    <div class="step2" data-step="b">...</div>
    <div class="step3" data-step="c">...</div>
  </Scrollama>
</template>

Scrollama Options

Props passed to the Scrollama component will be passed on to scrollama's setup method:

  • offset: (number, 0 - 1): How far from the top of the viewport to trigger a step. (default: 0.5)
  • progress: (boolean): Whether to fire incremental step progress updates or not. (default: false)
  • debug: (boolean): Whether to show visual debugging tools or not. (default: false)
  • order: (boolean): Whether to preserve step triggering order if they fire out of sync (eg. ensure step 2 enters after 1 exits). (default: true)
  • once: (boolean): Only trigger the step to enter once then remove listener. default: false
  • threshold: (number, 1+): The granularity of the progress interval, in pixels (smaller = more granular updates). (default: 4)
// example with offset set to 0.8
  <Scrollama @step-enter="stepHandler" :offset="0.8">
      ...
  </Scrollama>
</template>

Styling

If you inspect the DOM elements set up by Scrollama, you'll see three div elements:

  • .scrollama-container: overall container
  • .scrollama-steps: container for your step elements
  • .scrollama-graphic: container for your sticky graphic

Add to/override styles of these as per your requirements.

For higher specificity, passing an id prop to Scrollama will accordingly postfix the ids of the above div elements. See this example on CodeSandbox.

Examples

On CodeSandbox:

and more.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].