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

scroll-repeat

v0.2.7

Published

scroll-repeat =============

Downloads

1

Readme

scroll-repeat

Build Status

Angular directive for displaying a large number of items (100,000+) in a scrolling view.

How it works

scroll-repeat wraps Angular's ng-repeat directive, and provides optimized loading and unloading of on-screen and off-screen elements based on scroll position.

You can lay your items out any way you want, as long as they are all the same height and width. See our demo for some examples.

Usage

Get it with bower

bower install scroll-repeat

Reference the script

<script src="path/to/scroll-repeat.js"></script>

Add our module to your app

angular.module('myApp', ['litl']);

Use it just like you use ng-repeat

<div scroll-repeat="item in items">
    <span>{{item.name}}</span>
</div>

Advanced Features

Detect Clipping

When the browser's scroll position is changed too fast to keep up with the item rendering buffer, "clipping" may occur. You can detect when clipping occurs by watching the following properties:

// "top clipping" means items are missing from the top of the view
$scope.$watch('scrollRepeatClippingTop', function(val) {
    // if val == true, top clipping is occuring
});

// "bottom clipping" means items are missing from the bottom of the view
$scope.$watch('scrollRepeatClippingBottom', function(val) {
    // if val == true, bottom clipping is occuring
});

These properties can help you display an indication that items are being loaded.

scroll-repeat does not use isolated scope, so these properties are set on the scope where you define the directive.

Detect clipping demo

Placeholders

Empty placeholders are shown when scrolling moves too fast to keep up with ng-repeat data binding. These can be styled with the scroll-repeat-item-placeholder class.

By default, these placeholder items have no content. Content for placeholders can be defined separately from the bound item template, by using scroll-repeat-item and scroll-repeat-placeholder:

<div scroll-repeat="item in items">

    <div scroll-repeat-item>
        // content for bound items
        <span>{{item.name}}</span>
    </div>

    <div scroll-repeat-placeholder>
        // content for placeholder items
        <span>LOADING</span>
    </div>

</div>

Placeholders demo

Development

Install npm dependencies

npm install

Install bower dependencies

bower install

Run grunt

grunt

View the demo locally

http://localhost:8000

Known Issues

  • The more items you display on the screen at once, the larger the item buffer above and below the screen will be. This can result in performance issues if you try to cram too many items on the screen. The decrease in performance is especially noticable when using the scrollbar to make drastic jumps up and down the page.

  • Item offset position is calculated incorrectly on some mobile browsers (such as Safari for iOS) when scrolling causes the address bar to change width. This makes the items change position unexpectedly after scrolling comes to rest.