5

I have started using Webpack and I have installed VelocityJS(velocity-animate) from NPM.

I am importing it like this

import Velocity from 'velocity-animate';

but I don't really know how to use it.

For example ... How would I write this?

$('.secondary-content').velocity({translateX: '0%'});

I have tried this but it did not work.

Velocity.$('.secondary-content').velocity({translateX: '0%'})

QoP
  • 21,478
  • 16
  • 61
  • 69

2 Answers2

2
import Velocity from 'velocity-animate';
Velocity(toAnim, { opacity: 0.05 }, 1000);

Quelle: https://www.smashingmagazine.com/2014/09/animating-without-jquery/

My tested platform: + webpack@2.2.0 + webpack-dev-server@2.2.0 + babel-core@6.22.1 + babel-loader@7.2.10 + babel-preset-es2015@6.22.0

cheers! :D

Gfast2
  • 48
  • 5
1

I've use this and worked for me:

var $ = require('jquery');
window.jQuery = window.$ = $;
require('velocity-animate');
delete window.jQuery;
delete window.$;
Agu V
  • 1,644
  • 2
  • 21
  • 35