j-LazyContent
This component shows own content when it's visible. It supports helpful features as redraw and hide.
Configuration:
height:NUMBER_IN_PIXELS"optional, a default content height. Default value: is height of the current elementinit:method_or_variable"is executed when the element first time visible is (optional)redraw:method_or_variable"is executed when the element again visible is (optional)hide:method_or_variable"is executed when the element hidden is (optional)
Notes:
initwill be executed only one timeredrawandhidewill be executed more times- if the attributes contains link to
variable(not methods) then as value is storedBooleanvalue. - important: scroll area must be
document.bodyelement
Use it with <ui-component name="lazycontent">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.
<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>