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 );

猜你喜欢

转载自www.cnblogs.com/mcll/p/11551715.html