Web Component: j-Section
j-Section
- jComponent
v19|v20 - keeps a fixed percentage height
- great usage for intranet applications
- supports
releasing
Configuration:
height{Number}a percentage of heightparent{String}optional, a container with fixed height, can bewindow. Default value:parentelement.minheight{Number}a minimal height in pixels (default:0- disabled)scroll{Boolean}enables vertical scrolling (default:false- disabled)scrollbar{Boolean}shows scrollbar (default:false)delay{Number}msec.resizes the box again if the value is changed according to the path (default:100)visibleY{Boolean}still showsYscrollbar (default:false)visibleX{Boolean}still showsXscrollbar (default:false)scrolltop{Boolean}scrolls to top automatically if thepathis changed (default:false)margin{Number}optional, a top/bottom margin together (supportsautowhich is counted fromoffset.top, default:0)marginxs{Number}optional, a top/bottom margin together forxsscreen widthmarginsmoptional, a top/bottom margin together forsmscreen widthmarginmdoptional, a top/bottom margin together formdscreen widthmarginlgoptional, a top/bottom margin together forlgscreen widthinvisible{Boolean}iftruethen section setsinvisibleclass when is rendering (default:true)autofocus{Boolean/String}can focus an input.String===jQuery selectorfor the inputback{String}a title for back button (default:Back)delayanim{Number}animation delay (default:100)scrollbarshadow{Boolean}adds shadow for scrollbars (default:false)backexec{String}a link to thefunction(parent)that captures back button (it prevents standard behaviour)
Methods:
component.scrolltop(val)scrolls Ycomponent.scrollbottom(val)scrolls Y from bottom sidecomponent.resize()resizes container (it reacts onresizeevents automatically)component.resizescrollbar()resizes custom scrollbar (targeted for special cases)- NEW:
component.import(url)imports a new section from the URL address, response must be in the form<section data-if="...." - NEW:
component.import(html)imports a new section from the HTML in the form<section data-if="...." - NEW:
component.import(element)imports a new section from the rawSECTIONelement - NEW:
component.cancel([id])removes section dynamically
Definition:
<ui-component name="section" path="path">
<!-- path must have same value as "data-if" attribute -->
<section data-if="1" data-title="A title">
</section>
<!-- path must have same value as "data-if" attribute -->
<!-- "data-parent" enables Back button in the header and after click the component sets value from "data-parent" attribute -->
<section data-if="2" data-parent="1" data-title="A title">
</section>
<!-- GOOD TO KNOW: Dynamic compilation -->
<section data-if="3" data-parent="2" data-title="A title" data-back="link_to_function">
<!-- SCRIPT or TEMPLATE -->
<script type="text/html">
Will be compiled and rendered when the section will be displayed
</script>
</section>
<!-- Template from URL address -->
<section data-if="4" data-parent="2" data-title="A title" data-url="LINK_TO_HTML_TEMPLATE"></section>
</ui-component>
Section attributes:
data-ifmust contain a condition for displayingdata-parentcan contain a parentdata-ifdata-titlecontains a label/title for the sectiondata-reloadcan contain a link to thefunction(el)(optional)data-idcontains a custom identifier for replacing of all~ID~phrases in the content (optional)data-urlcan contain a link to the template (optional)
Good to know:
- If you want to add an additional content into the header to right side, just append inside of component e.g.
<div>BUTTON</div>. - You can dynamically insert/remove sections via
component.import()orcomponent.cancel()methods. - All section's attributes can be changed dynamically (e.g.
data-title,data-parent, etc.). - all
~PATH~phrases will be replaced for thedata-ifattribute value - all
~ID~phrases will be replaced for thedata-ifattribute value SET('path', 'if', 'right')will animated the content to the right side
Author
- Peter Širka petersirka@gmail.com
- License
Created
28. october 2020
Updated
19. june 2024
jComponent library
19 | 20
Version
v1
License
https://www.totaljs.com/license/
Dark mode
Yes
Responsive
Yes
Author
Peter Širka
Email
petersirka@gmail.com

