An open API service indexing awesome lists of open source software.

https://github.com/bkwld/vue-height-tween-transition

Tween the height of the parent of transitioning items for use in accordions or carousels.
https://github.com/bkwld/vue-height-tween-transition

transition vuejs

Last synced: 9 months ago
JSON representation

Tween the height of the parent of transitioning items for use in accordions or carousels.

Awesome Lists containing this project

README

          

# Vue Height Tween Transition

Tweens between heights of default slotted element.

![](http://yo.bkwld.com/0w3s302M0o2G/Screen%20Recording%202017-09-06%20at%2010.15%20AM.gif)

Demo: https://bkwld.github.io/vue-height-tween-transition/

## Usage

```javascript
// Add component
import 'vue-height-tween-transition/index.css'
Vue.component('height-tween', require('vue-height-tween-transition'))
```

#### Switching mode - Simultaneous

```vue





export default {
data: function () { return {
quotes: [{ id: 1, quote: 'Text' }, { id: 2, quote: 'Another'}],
active: 0,
}},
computed: {
quote: function () { return this.quotes[this.active] }
},
methods: {
next: function() { this.active++ }
},
}

.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
.fade-leave-active {
position: absolute;
width: 100%;
}

```

#### Switching mode - Out-In

```vue





export default {
data: function () { return {
quotes: [{ id: 1, quote: 'Text' }, { id: 2, quote: 'Another'}],
active: 0,
}},
computed: {
quote: function () { return this.quotes[this.active] }
},
methods: {
next: function() { this.active++ }
},
}

.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}

```

#### Toggle (Accordion) mode

```vue





export default {
data: function () { return {
quote: { id: 1, quote: 'Text' },
}},
}

```

## Notes

- To customize the height transition duration or other properties, define your own `height-tweening` CSS class.
- Doesn't work with `in-out` mode transitions ... though not sure why someone would use those...
- Expects a toggling transition to not use `mode`