<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@sj-js/partman/dist/css/partman.min.css">
<script src="https://cdn.jsdelivr.net/npm/@sj-js/crossman/dist/js/crossman.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@sj-js/partman/dist/js/partman.min.js"></script>
<script>
var partman = new PartMan();
</script>
npm install @sj-js/partman
require('@sj-js/partman/dist/css/partman.css');
const PartMan = require('@sj-js/partman');
const partman = new PartMan();
For convenience, 1-1 code, which loads and creates a Library in the example, is omitted.
Set data-part
attribute to target element and set color
<div data-part style="background:#EEFF88;">Hello Part Area 1</div>
<div data-part style="background:#DDAAFF;">Hello Part Area 2</div>
Run detect()
then, When Page is Loaded, detect and apply elements with a data-part
attribute
partman.detect();
👨💻
data-part-fold-a
attribute to button element to open folded content<button data-part-fold-a="fold-1">fold-1</button>
<button data-part-fold-a="fold-2">fold-2</button>
data-part-fold-tool
attribute to tool element on top of content<div data-part-fold-tool>
<button onclick="partman.closeContentAll();">X</button>
</div>
data-part-fold
attribute to folded content <div data-part-fold="fold-1">
1
</div>
<div data-part-fold="fold-2">
2
</div>
detect()
then, When Page is Loaded, detect and apply elements with a data-part
attribute partman.detect();