jguyet / jiji-container-scrolling

Javascript librarie for load intelligently list of pictures or greedy elements html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jiji-container-scrolling

NPM version license

Javascript librarie for load intelligently list of pictures or greedy elements html.

For the container element this librarie check all elements contained in container and an of an of three function is called for all elements

example :

<div id="photos">
    <img src="...">
    <img src="...">
    <img src="...">
    ... 3000 other pictures
</div>

I want load pictures only if is displayable.

const JijiContainerScrolling = require("jiji-container-scrolling");

let visibleFunctionCallBack = (element) => {
    element.src = "...";
};
let partialVisibleFunction = (element) => {};
let unVisibleFunction = (element) => {};

// visibleFunctionCallBack is callled if element visible in first parameter scrolling through each event
JijiContainerScrolling.init(document.getElementById('photos'), visibleFunctionCallBack, partialVisibleFunction, unVisibleFunction);

// manual check is callled if element visible in first parameter scrolling through each event
JijiContainerScrolling.checkVisibleContainerElementsWithoutCallBack(document.getElementById('photos'), visibleFunctionCallBack, partialVisibleFunction, unVisibleFunction);

If you search a simple framework js see [jiji-js.io]: https://jiji-js.io

Ref: How to check if element is visible after scrolling?

About

Javascript librarie for load intelligently list of pictures or greedy elements html

License:MIT License


Languages

Language:JavaScript 100.0%