FixMan
π
Index
1. Getting Started
1-1. How to load?
- Browser
<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/fixman/dist/js/fixman.min.js"></script>
<script>
var fixman = new FixMan();
</script>
- ES6+
npm i @sj-js/fixman
const FixMan = require('@sj-js/fixman');
const fixman = new FixMan();
1-2. Simple Example
For convenience, 1-1 code, which loads and creates a Library in the example, is omitted.
Example - fix top
Set data-fixed
to target element
<div data-fixed>Hello</div>
Run detect()
then, When Page is Loaded, detect and apply elements with a data-fixed
attribute
fixman.detect();
- π¨βπ»
<style>
.test1 { display:block; height:50px; border:2px solid black; margin-bottom:200px; }
</style>
<script>
fixman.detect();
</script>
<body>
<div class="test1">Please scroll down.</div>
<div class="test1" style="width:500px; background:#FFFFFF;" data-fixed>
<span style="font-size:30px">μλ
?</span>
<input type="text" value="Some Text">
<button onclick="alert('Testing');">π</button>
<button onclick="window.scrollTo({top:0, behavior:'smooth'});">π</button>
</div>
<div class="test1" style="width:250px; background:pink;">Hello?</div>
<div class="test1" style="width:200px; background:skyblue;">Annyeong?</div>
<div class="test1" style="width:300px; background:gold;">Konnichiwa? and Nihao? or Hola?</div>
</body>
Example - fix multiple