TehShrike / ractive-lazyload-img

A Ractive decorator that lazy-loads images when they get close to in view

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ractive-lazyload-img

A Ractive decorator that lazy-loads images when they get within 200px of the viewport.

Usage

const lazy = require('ractive-lazyload-img')

new Ractive({
	el: '#content',
	template: '#template',
	decorators: {
		lazy
	}
})
<img
	src="/transparent-pixel.png"
	as-lazy="'/path/to/images/' + dynamicImageName"
/>

License

WTFPL

About

A Ractive decorator that lazy-loads images when they get close to in view


Languages

Language:JavaScript 70.0%Language:HTML 30.0%