CSS3 list scroll effects

Overview

stroll.js – because it scrolls, and trolls.

A collection of CSS list scroll effects. Works in browsers with support for CSS 3D transforms including a special touch-enabled mode for iOS & Android 4.x.

Curious about how this looks in action? Check out the demo page.

Usage

The style of scroll effect is determined via the class that is set on the list. Once the class is set, stroll.js needs to be told to monitor that list via the bind method:

// Bind via selectors
stroll.bind( '#main ul' );

// Bind via element reference
stroll.bind( document.getElementById( 'some-list' ) );

// Bind via array of elements / jQuery object
stroll.bind( $( '#main .some-list' ) );

You can provide an additional parameter with more options:

// Makes stroll.js monitor changes to the DOM (like adding or resizing items). 
// This is taxing on performance, so use scarcely. Defaults to false.
stroll.bind( '#main ul', { live: true } );

To disable the effect on an already-bound list, you can use stroll.unbind():

// Same target options as stroll.bind
stroll.unbind( selector/element/array );

History

1.2 (master/beta)

  • Mobile support (iOS/Android 4+)
  • New effects

1.1

  • Optimizations
  • New API
  • New effects

1.0

  • Initial release

Contributors

License

MIT licensed

Copyright (C) 2017 Hakim El Hattab, http://hakim.se

Comments
  • Fix fast scroll bug

    Fix fast scroll bug

    The fast scroll action make that sometimes an element can have both past and future class.

    Simply avoid it by removing the useless class systematically.

    opened by tibolan 3
  • Fast scrolling bug + scroll events rather than reqAnimFrame

    Fast scrolling bug + scroll events rather than reqAnimFrame

    Hello! I really like your project, it has some pretty nice effects. Its just awesome!

    While playing around at the demopage I noticed some issues with scrolling up and down very fast. In some cases a few items inside the viewport still animate or just disappear because they still have classnames applied. So I had a look at the code and I also noticed that you are using requestAnimationFrame to change the classList on every child node. The problem here is that the update function will be called over and over again even though the user is not scrolling.

    I fixed the fast-scrolling-bug by adding a locking variable to the update function and I also fixed some tiny performance issues here and there. The big change I made was to use scroll events instead of using requestAnimationFrame so the update function will now only be called while the user is scrolling. Because of that I also had to change the TouchList and its swipe behavior. The swipe machanism still uses reqAnimFrame but only to reduce the velocity of the swipe...

    Overall I've managed to storten the code (TouchList now uses List's sync() and update() method).

    Please have a look at the changes and tell me what you think. Thanks!

    opened by bastimeyer 3
  • Fade effect in mobile

    Fade effect in mobile

    Hello,

    First of all sorry about my poor english. I can't play fade effect in my iPad but it works on web. The other effects works perfect but the fade effect no. Please help me.

    opened by ghost 2
  • [option] Use jQuery instead of JavaScript

    [option] Use jQuery instead of JavaScript

    If you want to use jQuery instead of native JavaScript (benefits: you can add items, less code and easier to read) use this code:

     $('ul#MyItemID').on('scroll', function (){
            var mh = $(this).height();
            $(this).children().each(function(){
                if ($(this).position().top < 0) {
                    if(!$(this).hasClass('past')) 
                        $(this).addClass('past');
                } else {
                    $(this).removeClass('past');
                }
                if ($(this).position().top > mh) {
                    if(!$(this).hasClass('future')) 
                        $(this).addClass('future');
                } else {
                    $(this).removeClass('future');
                }
            });
        });
    
    
    opened by torleif 2
  • Does not work in WebView on iPhone

    Does not work in WebView on iPhone

    I tried viewing your demo site on my iPhone 5 (iOS 6) inside a WebView in Tweetbot, and the scrolling simply did not work. It was like the site was broken.

    There should be a fallback in a case like this where it's not working to go back to normal scrolling.

    opened by FellowshipAgency 1
  • Stroll not working when I believe I've done everything to initiate it

    Stroll not working when I believe I've done everything to initiate it

    Hello, I love stroll.js and I am glad that I finally got to use it. However, it doesn't seem to be working when I include stroll.min.js, bind it to a list and its container, and add a class to the list that is the style of stroll; but, it seems to be behaving normally and not strolling on scroll.

    Here is a link to a live example: https://dl.dropbox.com/u/270523/help/stroll/index.html

    Update: I hadn't realised that I needed to add the stroll.min.css file. I did that, but it is still not working. Now, only the last

  • is being transformed.

  • opened by theirf 1
  • Definition of a list

    Definition of a list

    Yeah great, cool, awesome. But what about triggering this effects on mouse over. Don't really see the point with scrolling unless it's only for smart devices.

    opened by va5ja 1
  • Remove the WeakMap dependency

    Remove the WeakMap dependency

    I simplified @paulirish's code by removing the WeakMap dependency. OffsetTop and offsetHeight are now cached as properties of the list items instead. Since we only caches numeric values this doesn't leak any memory and is equally fast.

    opened by fgnass 1
  • Typo fix

    Typo fix

    Greetings,

    Just a small fix to 'fourty' (should be 'forty') that I noticed as I was enjoying the thrill of zooming up and down. :)

    Great library, btw. Thanks.

    opened by jedd 1
  • Its not working when I append <li> dynamically

    Its not working when I append
  • dynamically
  • This plugin works fine when I make static list but when I tried to append content with creating dynamic li ,that time its not working.Please suggest me the solutions. I really wanna use this plugin.

    opened by Arjun-Shinojiya 0
  • [enhancement] Add missing bower.json.

    [enhancement] Add missing bower.json.

    Hey, maintainer(s) of hakimel/stroll.js!

    We at VersionEye are working hard to keep up the quality of the bower's registry.

    We just finished our initial analysis of the quality of the Bower.io registry:

    7530 - registered packages, 224 of them doesnt exists anymore;

    We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

    Sadly, your library hakimel/stroll.js is one of them.

    Can you spare 15 minutes to help us to make Bower better?

    Just add a new file bower.json and change attributes.

    {
      "name": "hakimel/stroll.js",
      "version": "1.0.0",
      "main": "path/to/main.css",
      "description": "please add it",
      "license": "Eclipse",
      "ignore": [
        ".jshintrc",
        "**/*.txt"
      ],
      "dependencies": {
        "<dependency_name>": "<semantic_version>",
        "<dependency_name>": "<Local_folder>",
        "<dependency_name>": "<package>"
      },
      "devDependencies": {
        "<test-framework-name>": "<version>"
      }
    }
    
    

    Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

    NB! Please validate your bower.json with jsonlint before commiting your updates.

    Thank you!

    Timo, twitter: @versioneye email: [email protected] VersionEye - no more legacy software!

    opened by timgluz 0
  • how to add strolling effects for div elements within a div parent ?

    how to add strolling effects for div elements within a div parent ?

    html <div id='deck'> <div class='card flip'></div> <div class='card flip'></div> <div class='card flip'></div> </div> <script> stroll.bind($('#deck .card')); </script>

    stroll.min.css .flip{...} .flip div.card{...} .flip div.card.past{...}

    stroll.min.js if(!n.nodeName||/^(div|div)$/i.test(n.nodeName)===false){return false; }

    thanks in advance :)

    opened by Belle-1 0
  • it just doesn't work

    it just doesn't work

    i use the stroll.js file and css file like what is said in readme.md,but in my page,it seems like implementation in the initialization time. and also

        <li style="opacity:1;">   
       <ul style="overfolw:hidden;">  
    

    but when i scroll my page ,it doesn't work...i don't know what's wrong...

    opened by zhangmengxue 1
Owner
Hakim El Hattab
Making Slides.com and reveal.js • Creator of questionable value at https://lab.hakim.se
Hakim El Hattab
CSS3 Animations with special effects

?? magic CSS3 Animations with special effects. (→ 3.1 kB gzip) Demo Checkout the demo for the animations here Table of Contents Installation Getting S

Christian 7.9k Dec 30, 2022
Simple To-do list build using HTML5, CSS3, JavaScript and Webpack. You can add new tasks, remove and edit them.

Simple To-do list build using HTML5, CSS3, JavaScript and Webpack. You can add new tasks, remove and edit them.

Esteban Munoz 6 Mar 5, 2022
A webpack based todo list with HTML5, CSS3, JS and linters

Project Name This is a project to track your daily tasks as a todo list. This project doesn't have a backend so data gets saved in you local storage.

Ritobroto Mukherjee 19 Aug 22, 2022
This project is about Leaderboard list app, that allows users to add score to the list and refresh the list.

Leaderboard This project is about Leaderboard list app, that allows users to add score to the list and refresh the list. Built With JavaScript HTML CS

Mihreteab Misganaw 3 Dec 19, 2021
This "To-do-list" app is a simple web application that displays a list of task and allows you to add and remove task from that list. it is built with the latest technology namely; JavaScript with webpack Configuration.

To-do-list "To-do-list" is a simple web application that displays a list of task and allows you to add and remove task from that list. Built With HTML

Aniekan udo 10 Nov 21, 2022
This "To-do-list" app is a simple web application that displays a list of task and allows you to add and remove task from that list

This "To-do-list" app is a simple web application that displays a list of task and allows you to add and remove task from that list. it is built with the latest technology including but not limited to HTML, CSS, JavaScript and webpack to manipulate DOM.

Jerry Owusu 2 Feb 19, 2022
"To Do List" is a minimalist project that displays a list of task and allows you to add and remove task from that list. Built with JavaScript

To Do List Structure Solo programming project for module 2 week 2 of the Microverse Program. Live Demo Live Demo Link "To Do List" is a minimalist pro

Yersel Hurtado 7 Mar 5, 2022
TODO List is a simple website that displays a list of todo and allows you to add and remove todo from that list.

Todo TODO List is a simple website that displays a list of todo and allows you to add and remove todo from that list. App Screenshot Live Demo Todo Ap

Ishmael Kargbo 3 May 12, 2022
To-Do List project is the application for a to-do list, users can add and remove tasks from the to-do list. Mark tasks as completed.

To Do App To-Do List project is the application for a to-do list, users can add and remove tasks from the to-do list. Mark tasks as completed. Users c

Ishpaul Singh 6 Jul 21, 2022
This Project is made with HTML5, CSS3, ReactJS, Axios, MetaMask, thirdweb, Rinkeby Test Network, Web 3.0 Technologies, and OpenSea API.

Abstract Collections This Project is made with HTML5, CSS3, ReactJS, Axios, MetaMask, thirdweb, Rinkeby Test Network, Web 3.0 Technologies, and OpenSe

Shobhit Gupta 34 Jan 4, 2023
A planetary body simulator with a HTML5/CSS3/JS frontend and simulated using Rust WebAssembly.

Solar Sim ?? A planetary body simulator with a HTML5/CSS3/JS frontend and simulated using Rust WebAssembly. Try the latest version here! Built with ??

Ben Plate 3 Jun 15, 2022
CSS3 vendor prefix generator.

cssFx cssFx adds vendor-specific prefixes to your stylesheets. How it works When the document has finished loading, internal (<style>) and external (<

Ivan Malopinsky 275 Jul 30, 2022
Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser. Read this file in Portuguese-BR here Our Website is outd

Modernizr 25.4k Jan 3, 2023
Responsive, CSS3, touch-enabled jQuery Coverflow plugin.

jQuery.Flipster Flipster is a CSS3 3D transform-based jQuery plugin built to replicate the familiar 'cover flow' effect, but also supports a variety o

Adrien Delessert 704 Dec 28, 2022
Convert Tailwind CSS class names into their CSS3-equivalent styles — right from Alfred.

alfred-tailwind2css Tailwind2CSS offers you the ability to convert TailwindCSS classes into their CSS3-equivalent styles -- right from within Alfred.

Stephan Casas 6 Dec 7, 2022
Adding volumetric effects to a built-in Three.js shader.

Magical Marbles in Three.js Adding volumetric effects to a built-in Three.js shader. Article on Codrops Demo Installation Install dependencies: yarn

Matt Rossman 68 Dec 9, 2022
Playful and Colorful One-Page portfolio featuring Parallax effects and animations. Especially designers and/or photographers will love this theme! Built with MDX and Theme UI.

Gatsby Starter Portfolio: Cara Playful and Colorful One-Page portfolio featuring Parallax effects and animations. Using the Gatsby Theme @lekoarts/gat

prashanth s 1 Dec 24, 2021