j-FloatingBox
- supports dark mode
Configuration:
zindex {Number}a default z-index for forms (default:10)
Methods:
component.show(opt)shows a boxopt.id {String}required - a box identifieropt.element {HTML Element}required - target element- or you can use absolute position:
opt.x {Number}opt.y {Number}
opt.offsetX {Number}affects offset Xopt.offsetY {Number}affects offset Yopt.align {String}alignleft(default),centerorrightopt.position {String}aligntop(default),bottomopt.minwidth {Number}opt.maxwidth {Number}opt.mouseleave {String}a link to the method, it's executed when the mouse cursor leaves the boxfunction(e, close)}opt.autofocus {Boolean}tries to focus first input/textareaopt.hide {String}a link to the methodfunction(box_element)opt.show {String}a link to the methodfunction(box_element)opt.autohide {Boolean}enables hiding a box after clicking on itopt.delay {Number}a simple delay for rendering (default:0)opt.scrolltop {Boolean}it deducts scroll top position from the current offset Y (default:false)opt.url {String}optional, URL address for the contentopt.path {String}will replace all~PATH~phrases in the downloaded templateopt.ID {String}will replace all~ID~phrases in the downloaded template
component.hide()hides the last open boxcomponent.hide([box_id])hides the specific box and its all nested boxescomponent.hide(true)hides all boxes
Boxes
<div class="floatingbox" data-id="yourid" data-config="">
Your content
</div>Configuration:
init {String}a link to the method, it's executed when the box is initialized the first timefunction(element)reload {String}a link to the methodfunction(element)hide {String}a link to the method, it's executed when the box is going to hidefunction(element)scope {String}a custom scope/plugin namezindex {Number}a custom z-index for this box
Use it with <ui-component name="floatingbox">. 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.
<ui-component name="exec"></ui-component>
<ui-component name="floatingbox" config="zindex:10"></ui-component>
<!-- Form templates -->
<div class="floatingbox" data-id="1" style="width:200px">
<div class="padding">
<div>Box 1</div>
<br />
<br />
<br />
</div>
</div>
<div class="floatingbox" data-id="2" data-config="init:box2init">
<div class="padding">
<div>Box 2</div>
<br />
<br />
<br />
<span class="exec" data-exec="showbox" data-id="3" style="color:#2A6CEC;cursor:pointer;text-decoration:underline">Show box 3</span>
</div>
</div>
<div class="floatingbox" data-id="3">
<div class="padding">
Box 3
</div>
</div>
<!-- Executors -->
<div class="row">
<div class="col-xs-4">
<span class="exec" data-exec="showbox" data-id="1" style="color:#2A6CEC;cursor:pointer;text-decoration:underline" class="block">Show box 1</span>
</div>
<div class="col-xs-4">
<span class="exec" data-exec="showbox" data-id="2" style="color:#2A6CEC;cursor:pointer;text-decoration:underline" class="block">Show box 2</span>
</div>
<div class="col-xs-4">
<span class="exec" data-exec="showbox" data-id="3" style="color:#2A6CEC;cursor:pointer;text-decoration:underline" class="block">Show box 3</span>
</div>
</div>
<script>
function showbox(el) {
var opt = {};
opt.element = el;
opt.id = el.attrd('id');
SETTER('floatingbox/show', opt);
}
function box2init(el) {
console.log('Box 2 is initialized', el);
}
</script>