stuck-js
TypeScript icon, indicating that this package has built-in type declarations

2.1.4 • Public • Published

Stuck.js

CircleCI npm version david-dm

A sticky library handles stack of stickies without dependencies(like jQuery) Demo: https://ryonkmr.github.io/stuck-js/

Quickstart

Setup

you can download from npm:

$ npm i -S stuck-js

or github releases.

Code

<style>
  header {
    height: 100px;
    z-index: 100;
  }
  .ad {
    width: 300px;
    height: 250px;
  }
</style> 
<body>
  <header style="height: 100px; z-index: 100;">
    <h1>This is my first website</h1>
    <!-- header contents -->
  </header>
  <div>
    <main>
      <!-- main contents -->
    </main>
    <div id="js-sidebar">
      <aside class="js-sticky-ad ad ad--01"><!-- ad contents --></aside>
      <aside class="js-sticky-ad ad ad--02"><!-- ad contents --></aside>
    </div>
  </div>
  <script src="lib/stuck.js"></script> 
  <script>
  const Stuck = StuckJs.Stuck;
  const instances = new Stuck([
    { selector: '#js-header', marginTop: 0 },
    { selector: '.js-sticky-ad', wrapper: '#js-sidebar' },
  ], { marginTop: 10 });
  </script> 
</body>

Dependents (1)

Package Sidebar

Install

npm i stuck-js

Weekly Downloads

35

Version

2.1.4

License

MIT

Unpacked Size

32.8 kB

Total Files

23

Last publish

Collaborators

  • resessh
  • ryonkmr
  • ymmooot