5.0.0 • Published 4 years ago

@ianwalter/sled v5.0.0

Weekly downloads
167
License
SEE LICENSE IN LI...
Repository
github
Last release
4 years ago

@ianwalter/sled

A JavaScript micro-library for animating an element's height to create a slide effect

npm page

About

I created Sled because I wanted to use Bootstrap's collapsible navbar menu without having to import a bunch of unnecessary code. Sled is 20 lines of code, 182 bytes, and has no dependencies.

Demo

Click here to see the demo.

Installation

npm install @ianwalter/sled --save

Usage

Vanilla JavaScript example:

import Sled from '@ianwalter/sled'
const sled = new Sled(document.querySelector('#myEl'))

// Slide to a specific height:
sled.slide('100px')

// Toggle between 0 height and the elements natural height.
sled.toggle()

Vue.js example:

import Sled from '@ianwalter/sled'

let sled

export default {
  mounted () {
    sled = new Sled(this.$refs.menu)
  },
  methods: {
    toggleMenu: () => sled.toggle()
  }
}

Related

License

Apache 2.0 with Commons Clause - See LICENSE

 

Created by Ian Walter

5.0.0

4 years ago

4.0.0

5 years ago

3.0.0

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago