简单饼图不能:使用Waypoint JS加载动画
Easy pie chart does not: loading animation using Waypoint JS
我正在设计一个单页滚动网页。在网页上,我使用简单的饼状图在我的技能页面。现在我想在到达技能页面时加载简单的饼状图动画。我使用了路径点js,但它不起作用。它加载动画时,我在技能页面,但当我在顶部和刷新页面&然后去技能页面,它不能工作。
我的代码如下
custom.js:
jQuery('.skill').waypoint(function() {
$('.chart1').easyPieChart({
animate: 4000,
barColor: '#000',
trackColor: '#ddd',
scaleColor: '#e1e1e3',
lineWidth: 15,
size: 152,
});
}, {
triggerOnce: true,
offset: 'bottom-in-view'
});
现在我该如何解决这个问题呢?
你可以试试这个代码:
$(window).scroll( function(){
/* Check the location of each desired element */
$('.skill').each( function(i){
var bottom_of_object = $(this).offset().top + $(this).outerHeight();
var bottom_of_window = $(window).scrollTop() + $(window).height();
/* If the object is completely visible in the window, fade it in */
if( bottom_of_window > bottom_of_object ){
$('.skill').easyPieChart({
size: 140,
lineWidth: 6,
lineCap: "square",
barColor: "#22a7f0",
trackColor: "#ffffff",
scaleColor: !1,
easing: 'easeOutBounce',
animate: 5000,
onStep: function(from, to, percent) {
$(this.el).find('.percent').text(Math.round(percent));
}
});
}
});
});
相关文章:
- 可以't让我的if语句处理js中的html表单输入
- 使用agility.js进行页面布局和合成
- 使用Clipboard.js复制span文本
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 强制模板刷新ember.js
- 如何编写HTML输入的JS内联
- Angular JS IE9 Hashbang url rewriting
- 使用JS将数组转换为json对象
- Node.js v6.2.0类扩展不是函数错误
- 当js函数's已执行
- 要求未定义JS回调参数
- 在自定义mean.io包中使用angular-chart.js作为依赖项
- 无法在数据endVal中设置值=“”;{{ucount}}”;使用Angular JS的CountUp
- 如何从Java/scala调用js美化程序
- 如何更改<svg>标记为<img>用js标记
- 如何使用 node.js 比较两个 json 数组
- Waypoint.js:当距离顶部N距离时添加类
- WordPress and Waypoint Js
- 简单饼图不能:使用Waypoint JS加载动画
- 组合jQuery库:reality -type .js和waypoint.js