最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - VelocityJS(velocity-animate) + WebPack - How can I use it? - Stack Overflow

programmeradmin0浏览0评论

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%'})

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%'})

Share Improve this question edited Jul 15, 2016 at 1:10 QoP asked Dec 15, 2015 at 9:31 QoPQoP 28.4k16 gold badges77 silver badges76 bronze badges 3
  • I have the same issue. – Agu V Commented Apr 26, 2016 at 16:44
  • 1 @AguV I found a solution long time ago but it required jQuery, do you want me to write it as an answer? – QoP Commented Apr 26, 2016 at 16:58
  • I've found that solution as well. Thank you! – Agu V Commented Apr 26, 2016 at 17:01
Add a ment  | 

2 Answers 2

Reset to default 4
import Velocity from 'velocity-animate';
Velocity(toAnim, { opacity: 0.05 }, 1000);

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

My tested platform: + [email protected] + [email protected] + [email protected] + [email protected] + [email protected]

cheers! :D

I've use this and worked for me:

var $ = require('jquery');
window.jQuery = window.$ = $;
require('velocity-animate');
delete window.jQuery;
delete window.$;
发布评论

评论列表(0)

  1. 暂无评论