3.1.2 β€’ Published 4 years ago

@stereorepo/collant v3.1.2

Weekly downloads
59
License
ISC
Repository
github
Last release
4 years ago

Collant 🍯

Alban πŸ”₯ See Collant as Post-itβ„’ for the web. With it you can stick any element you want, like a pro πŸ‘Œ

Installation

npm i -S @stereorepo/collant

Usage

How it works on paper

The container will... contain (πŸ‘) all the elements you'll need to create magic.

The clickable element (frequently your accordion title) will allow us to reveal the accordion content when clicked.

Its first and only bro : the content wrapper.

The content wrapper will be the expanding/contracting element. We will change its max-height css property to reveal/hide the accordion content.

We need a content container to know the height of our actual content.

The html

<!-- ... -->
<div class="js-context">
    <div class="js-box">
        <div class="js-collant"></div>
    </div>
</div>
<!-- ... -->

Example

// You can import the vanilla Collant
import { Collant } from '@stereosuper/collant';
// or the Vue.js version of it
import { CollantVue } from '@stereosuper/collant';

const [contextElement] = query({
    selector: '.js-context'
});

// then instanciate it
const collant = new Collant({
    ctx: contextElement,
    selector: '.js-nav-btn',
    box: '.js-ref-first-part',
    offsetTop: '100px'
    // you can also use vh units
    // offsetTop: '20vh'
}),

// and finally watch the magic happen
collant.stickIt();

// when you wanna get rid of it, simply unstick it
collant.ripIt();

constructor

ctx

This is a contextual element to give you the ability to efficiently stick the element you need.

selector

This will be the collant element.

box

This element will be the box in which your collant will stick.

offsetTop

This is the offset value from the top of your window.

You can pass px or vh values like that '10px', '20vh';

offsetBottom

The same as offsetTop, but for the bottom of the window.

You can pass px or vh values like that '10px', '20vh';

Note that offsetBottom will override offsetTop.

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.16

4 years ago

3.0.15

4 years ago

3.0.14

4 years ago

3.0.13

4 years ago

3.0.12

4 years ago

3.0.10

4 years ago

3.0.11

4 years ago

3.0.9

4 years ago

3.0.8

4 years ago

3.0.7

4 years ago

3.0.6

4 years ago

3.0.5

4 years ago

3.0.4

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.1.8

4 years ago

2.1.7

4 years ago

2.1.9

4 years ago

2.1.6

4 years ago

2.1.5

4 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.6.13

5 years ago

1.6.12

5 years ago

1.6.11

5 years ago

1.6.10

5 years ago

1.6.9

5 years ago

1.6.8

5 years ago

1.6.7

5 years ago

1.6.6

5 years ago

1.6.5

5 years ago

1.6.4

5 years ago

1.6.3

5 years ago

1.6.2

5 years ago

1.6.1

5 years ago

1.6.0

5 years ago

1.5.11

5 years ago

1.5.7

5 years ago

1.5.6

5 years ago

1.5.5

5 years ago

1.5.3

5 years ago

1.5.1

5 years ago