ForgeComponentes
es

Componentes

j-LazyContent

jComponent 20 · jcomponent@20 component Ejemplo cargado con jComponent 20

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.

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>