Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on waypoints and jquery-circle-progress #145

Closed
soniapello opened this issue Apr 23, 2017 · 4 comments
Closed

Question on waypoints and jquery-circle-progress #145

soniapello opened this issue Apr 23, 2017 · 4 comments

Comments

@soniapello
Copy link

soniapello commented Apr 23, 2017

Hi!

I wonder if it's possible to have the circle progress and animate it on waypoints. Because now the circle doesn't show and it appears when the offset is reach.

I've made a stackoverflow question here with the demo.

Thanks!

@kottenator
Copy link
Owner

kottenator commented Apr 23, 2017

Hi!

I've answered you on SO.

Shortly:

  1. Init the circle with value: 0 - it'll be rendered "empty".
  2. Do .circleProgress({value: realValue}) when the circle reaches the waypoint.

Here's a working demo, and another demo (a bit different implementation), and one more demo (using jQuery Appear instead of jQuery Waypoints).

This issue is related to #8. As you can see, one of the first project issues/questions was about the lazy rendering :)

@kottenator
Copy link
Owner

I hope I've helped you. I'm closing this ticket, but feel free to reopen.

@soniapello
Copy link
Author

soniapello commented Apr 24, 2017

@kottenator you've helped me a lot thank you for your explanation and your plugin

@kottenator
Copy link
Owner

In this link I use Waypoints with multiple circles.

If you want to make it in pure JS (though it'd be not 100% pure because of my plugin):

var elements = document.querySelectorAll('.circle');

Array.prototype.slice.apply(elements).forEach(function(el) {
  var $el = $(el);

  $el.circleProgress({value: 0});

  new Waypoint({
    element: el,
    handler: function() {
      $el.circleProgress({
        value: $el.data('value')
      });
      this.destroy();
    },
    offset: '50%'
  });
});

Here's a demo example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants