s-melnikov
3/9/2016 - 4:58 PM

test.js

$('.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));
        }
      });
    }
  }
});