Dynamic web app 'presentations', driven by user scrolling, inspired by the NYT

Overview

Museé

A small Typescript-based web app, inspired by the NYT Close Reading of Auden's Museé des Beaux Arts.

Introduction

I loved the NYT Close Reading -- both because I loved the Auden poem, of course of course, but also because I was captivated by the way in which the reading itself was presented. The reader scrolls through sentences and sections of Elisa Gabbert's essay... and as they scroll the rest of the page is driven to highlight images or words that are the subject of that portion of the essay.

"What I'd really love," I thought, "is to write all my tutorials and documentation, for technical work, using a system like this!" (It's a very limited vision, nothing as grand as an explication of Auden's meditation on suffering and art, but often a limited vision is all we have.)

I didn't look at the code behind the NYT app at all. Even now I still don't know how they implemented it, and I don't want to know.

But I'd recently been browsing the docs for Javascript's Intersection Observer API, and that seemed well-suited to a task like this, so I spent a night coding up a simple version based -- each section of "content" is displayed or removed on the righthand side of the screen as each scrollable "control" block on the left appears or disappears in the user's viewport -- and this is what a few hours of work got me.

Installation

Once you've cloned the repository, you'll need to run

$ npm install

to install the dependencies -- and then to run a local (development) server,

$ npm run dev 

After that, your server should be running on http://localhost:3000/ (or perhaps on a different port, if there was something already running on port 3000 on your machine).

Configuring a Presentation

At the moment, you can see an example configuration in the example.json file, located under the pages folder. Currently, this JSON document is loaded statically when NextJS compiles the page the first time; this means that if you change the file while the dev server is running, you'll have to restart the dev server to see the updates.

(In the future, we'll load these configuration files dynamically rather than compiling them statically like this; see Future Work below.)

Each JSON configuration file has a key, steps, whose value is an array of Musee Step objects.

{
    "steps": [
        ...
    ]
}

A Musee Step object has two keys, instruction and content.

{
    "instruction": "Here is some string instruction, that is shown on the left-hand (scrollable) portion of the display", 
    "content": {
        ...
    }
}

The value of an instruction is just a string, but there are four types of content objects:

  • Empty
  • String
  • Image
  • Zoomed Image

They are classified by a common type field, with values in the set { "empty", "string", "image", "zoom" }, and the type of content determines what is shown on the righthand side of the page when the corresponding instruction is visible on the left.

For example,

{
    "type": "empty"
}

Just shows a blank page on the right, while

{
    "type": "image", 
    "src": "example.png"
}

will insert an HTML image element with a src URL of /images/example.png, which is served from the public/images folder in this project. (Support for remote images will be added later.)

Future Work

  • Integrate with embedded reveal.js?
  • replace the all-or-nothing rendering on the righthand side of the page, with a .scrollInToView() type call, on a (very tall) div of images or content
  • load json configuration from an API rather than statically compiling it in
  • add other 'content types' e.g. raw html
You might also like...

Food Delivery APP is a website designed to provide interactive user experience and increase user engagement when ordering food delivery.

Food-Delivery-APP Features Food Delivery APP is a website built with HTML/Tailwind CSS/JavaScript, React and enhanced with 3D design using Spline to p

Oct 6, 2022

io-ts Typed Event Bus for the runtime of your Node.js application. A core for any event-driven architecture based app.

Typed Event Bus Based on io-ts types, this bus provides a handy interface to publish and consume events in the current runtime of the Node.js process.

May 23, 2022

Make the content slide prettily across the screen with variable sizes of scrolling items, in any of four directions, pausing while the mouse is over the marquee, and all with vanilla JavaScript.

TEG Marquee Make the content slide prettily across the screen with variable sizes of scrolling items, in any of four directions, pausing while the mou

Dec 30, 2021

Seamless and lightweight parallax scrolling library implemented in pure JavaScript utilizing Hardware acceleration for extra performance.

parallax-vanilla.js Seamless and lightweight parallax scrolling library implemented in pure JavaScript utilizing Hardware acceleration for extra perfo

Dec 16, 2022

Given a list of items, only render what's visible on the screen while allowing scrolling the whole list.

Solid Windowed Given a list of items, only render what's visible on the screen while allowing scrolling the whole list. A Solid component. See https:/

Dec 21, 2022

A lightweight, performant, and simple-to-use wrapper component to stick section headers to the top when scrolling brings them to top

A lightweight, performant, and simple-to-use wrapper component to stick section headers to the top when scrolling brings them to top

Jun 27, 2022

pagePiling plugin by Alvaro Trigo. Create a scrolling pile of sections. http://alvarotrigo.com/pagePiling/

pagePiling plugin by Alvaro Trigo. Create a scrolling pile of sections. http://alvarotrigo.com/pagePiling/

pagePiling.js Pile your sections one over another and access them scrolling or by URL! Live demo Creating hugeinc.com website with pagePiling.js Who i

Dec 29, 2022

A lightweight script to animate scrolling to anchor links.

DEPRECATION NOTICE: Smooth Scroll is, without a doubt, my most popular and widely used plugin. But in the time since I created it, a CSS-only method f

Dec 26, 2022

An infinite scrolling plugin for jQuery.

jScroll - jQuery Plugin for Infinite Scrolling / Auto-Paging Official site at jscroll.com. Copyright © Philip Klauzinski Dual licensed under the MIT a

Dec 29, 2022
Comments
  • Adding support for zoomed images

    Adding support for zoomed images

    Adds a new content type,

    {
      "type": "zoom", 
      "src": "some-image-name", 
      "tx": (number of pixels to translate in x direction), 
      "ty": (number of pixels to translate in y direction), 
      "scale": (scaling factor) 
    }
    

    And an example of using the zoom content is added to the example.json file

    opened by tdanford 0
  • Adding dynamic loading for JSON configuration files

    Adding dynamic loading for JSON configuration files

    1. Move the example.json file into the public folder,
    2. Update the documentation.tsx page to dynamically load it from that location
    3. Have at least some minimal error handling if the load fails
    4. Update the README documentation
    opened by tdanford 0
Owner
Timothy Danford
Timothy Danford
Dynamic-web-development - Dynamic web development used CSS and HTML

Dynamic-web-development ASSISNMENT I just used CSS and HTML to make a mobile int

null 1 Feb 8, 2022
An indexed compendium of graphics programming papers, articles, blog posts, presentations, and more

Paper Bug CONTRIBUTIONS WANTED What is this? The idea is to have an annotated and easily searchable repository of papers, presentations, articles, etc

Jeremy Ong 64 Dec 16, 2022
dynamic-component-app is an angular application for dynamic component template creation

MyApp This project was generated with Angular CLI version 14.1.0. Development server Run ng serve for a dev server. Navigate to http://localhost:4200/

Aniket Muruskar 7 Aug 26, 2022
'event-driven' library aims to simplify building backends in an event driven style

'event-driven' library aims to simplify building backends in an event driven style(event driven architecture). For message broker, light weight Redis Stream is used and for event store, the well known NoSQL database, MongoDB, is used.

Sihoon Kim 11 Jan 4, 2023
Hadmean is an internal tool generator. It is language agnostic, schema driven, extremely customizable, featured packed, user-friendly and has just one installation step.

Hadmean Report a Bug · Request a Feature · Ask a Question Table of Contents About Quick Demo Motivation Why you should try Hadmean Getting Started Pre

Hadmean 344 Dec 29, 2022
Scrolling navigation component for web apps

Slinky.js Create beautiful scrolling driven navigation lists with stacking headers that remain visible at all times. Scroll around on the plugin homep

Sorin Iclanzan 201 Nov 16, 2022
Satyam Sharma 3 Jul 8, 2022
A live instant messaging app that translates user messages into the other user's preferred language.

BabelFish Description BabelFish is an interactive multi-person chat app with built in live translation. It is created using the MERN stack (MongoDB, E

Jamel 3 Jul 18, 2022
AweSome Book App displays the book details entered by user and saves the information in Local storage. User can add and remove a book title/author to the library and from the library.

Awesome Book App with ES6 Used npm init -y command to create package.json file. Created the entry point for the JavaScript code called index.js Create

Krishna Prasad Acharya 8 Aug 15, 2022