vue 动画滑动

我是在vue中引入jquery使用的

第一步:安装jquery插件

npm install jquery --save


第二步:配置文件 webpack.base.conf.js:
 const webpack = require('webpack')
plugins:[ new webpack.ProvidePlugin({ $: 'jquery', jQuery:'jquery' }) ],
main.js:
import $ from 'jquery'

第三步:在需要的文件中配置

import $ from "jquery";
 
获取距离左边的距离
document.getElementById("headerTopTitle1").scrollLeft;
 
滑动相应的距离带动画
 $("#headerTopTitle1").animate(
         {
              scrollLeft: (this.leftScroll -= 60)
         },1000 );

posted on 2019-09-19 18:46  旺仔小裤头  阅读(320)  评论(0编辑  收藏  举报