Skip to content

Instantly share code, notes, and snippets.

@s-melnikov
Created March 9, 2016 16:58
Show Gist options
  • Save s-melnikov/cd21e8962f0f9b0f52a8 to your computer and use it in GitHub Desktop.
Save s-melnikov/cd21e8962f0f9b0f52a8 to your computer and use it in GitHub Desktop.
$('.page_2').bind('inview', function(event, visible, visiblePartX, visiblePartY) {
if (visible) {
if ($('.percentage').data('easyPieChart')) {
var percentage = $('.percentage'),
chart1 = percentage.eq(0).data('easyPieChart'),
chart2 = percentage.eq(0).data('easyPieChart');
chart1.options.animate = chart2.options.animate = 0;
chart1.update(0);
chart2.update(0);
chart1.options.animate = chart2.options.animate = 2000;
chart1.update(99);
chart2.update(99);
} else {
$('.percentage').easyPieChart({
animate: 2000,
lineWidth: 4,
onStep: function(value) {
this.$el.find('span').text(Math.round(value));
},
onStop: function(value, to) {
this.$el.find('span').text(Math.round(to));
}
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment