Skip to content

Instantly share code, notes, and snippets.

@edwardlorilla
Last active May 9, 2022 08:49
Show Gist options
  • Save edwardlorilla/3aeb8f7ee39ba8d5f250f7cf743274ac to your computer and use it in GitHub Desktop.
Save edwardlorilla/3aeb8f7ee39ba8d5f250f7cf743274ac to your computer and use it in GitHub Desktop.
velocity vuejs
<div id="app">
<div id="div1" ref="expandBox" class="box"></div>
<div ref="expandBoxTwo" class="box"></div>
<button @click="expandBox">expandBox</button>
</div>
new Vue({
el: '#app',
methods:{
expandBox(){
Velocity(this.$refs.expandBox, {
width: '300px'
}, {
duration: 3000
})
Velocity(this.$refs.expandBoxTwo, {
width: '300px'
}, {
duration: 3000,
delay: 3000
})
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.3/vue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.5.0/velocity.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.5.0/velocity.ui.js"></script>
.box{
width: 100px;
height:100px;
background-color: red;
}
@rutvik106
Copy link

@edwardlorilla Hi your code helped me, But can you show how I can use animation from velocity UI pack.

Like what would be Vue JS equivalent for $elements.velocity("callout.bounce");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment