# j-LazyContent

> Este componente muestra contenido propio cuando está visible. Admite funciones útiles como volver a dibujar y ocultar.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: es
Content-SHA256: dda7da8f7f91e2fad0dbc479f089ca9e2d34c111ecfd11c71cc60278b34c3a15
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

Este componente muestra contenido propio cuando está visible. Admite funciones útiles como `redraw` y `hide`.

__Configuración__:
- `height:NUMBER_IN_PIXELS"` opcional, una altura de contenido predeterminada. __Valor predeterminado__: es la altura del elemento actual
- `init:method_or_variable"` se ejecuta cuando el elemento visible por primera vez es (opcional)
- `redraw:method_or_variable"` se ejecuta cuando el elemento nuevamente visible es (opcional)
- `hide:method_or_variable"` se ejecuta cuando el elemento oculto está (opcional)

__Notas__:
- `init` se ejecutará sólo una vez
- `redraw` y `hide` se ejecutarán más veces
- si los atributos contienen un enlace a `variable` (no métodos), entonces como valor se almacena el valor `Boolean`.
- __importante__: el área de desplazamiento debe ser el elemento `document.body`

Úselo con `<ui-component name="lazycontent">`. Cuando el componente aún no está cargado, jComponent lo descarga en el primer uso desde la dirección en `DEF.fallback` (el CDN Componentator de forma predeterminada). Autor: Peter Širka. Fuente: repositorio de componentes Componentator, licencia MIT.

```html example.html
<div><b>SCROLL DOWN</b></div>
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<ui-component name="lazycontent" config="init:method_init;redraw:method_redraw;hide:method_hide">
	.... default content ....
</ui-component>
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />
<ui-component name="lazycontent" config="init:method_init;redraw:method_redraw;hide:method_hide">
	.... default content ....
</ui-component>
<br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br />

<script>
	function method_init() {
		this.element.html('INIT');
		this.element.css('background-color', 'green');
	}

	function method_redraw() {
		this.element.html('REDRAW');
		this.element.css('background-color', 'blue');
	}

	function method_hide() {
		this.element.html('HIDDEN');
		this.element.css('background-color', 'red');
	}
</script>
```
